my problem is that my code used to find patterns in words find "pattern" letter by letter. (My goal is to use my code to find whole patterns in one word, for example, for word "abcabcabc" and pattern "abc" i would like to achive result of "3".)
There is my code
case 2:{
string text, pattern;
int a, b;
int counter = 0;
cin >> text >> pattern;
for (a = 0; a < text.size(); a++) {
for (b = 0; b < pattern.size(); b++) {
if (text[a] == pattern[b])
counter++;
}
}
cout << counter;
break;
}