Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- string text;
- string pattern;
- cin >> text;
- cin >> pattern;
- for(int i = 0; i < (int) text.size(); i++) {
- if(text[i] == pattern[0]) {
- bool ok = true;
- for(int j = 0; j < (int) pattern.size(); j++) {
- if(i + j >= (int) text.size() or pattern[j] != text[i + j]) {
- ok = false;
- break;
- }
- }
- if(ok) {
- cout << "DA postoi" << endl;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement