Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //5
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main()
- {
- char str[51];
- cin.getline(str, 50);
- int c = 0;
- for(int i = 0; i < strlen(str) - 2; i++) {
- if(str[i] == 'a' && str[i + 1] == 'b' && str[i + 2] == 'a'){
- c++;
- }
- }
- cout << c;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement