Advertisement
Serega

Down the Hatch!

Jul 24th, 2013
1,084
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <cstdio>
  4. #include <vector>
  5. #include <algorithm>
  6. #include <cmath>
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11.     int n;
  12.     string s;
  13.     cin >> n;
  14.     getline(cin, s);
  15.     getline(cin, s);
  16.     int ans = 0;
  17.     for (int i = n; i < s.length(); i += n)
  18.         if (s[i - 1] == s[i - 2] && s[i - 2] == s[i - 3])
  19.             ++ans;
  20.     cout << ans << endl;
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement