Last active
February 22, 2017 03:22
code for blogger.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() { | |
ios::sync_with_stdio(0); | |
cin.tie(0); | |
int k; | |
string s; | |
while ( cin >> k >> s ) { | |
int seg = 0, ans = 0; | |
for ( int i=0; i+k<s.size(); i++ ) { | |
if ( s[i] == s[i+k] ) | |
seg++; | |
else | |
seg = 0; | |
if ( seg >= k ) | |
ans++; | |
} | |
cout << ans << '\n'; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment