Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int main()
- {
- char c[1000000];
- int len, s, i, j, k, max, ano;
- while(scanf("%s\n", c) != EOF) {
- len = strlen(c);
- s = len/2;
- max = 1;
- ano = 0;
- for(i = 2; i < len+1; i++) {
- if(len%i)
- continue;
- s = len/i;
- ano = 1;
- for(j = 1; ano & (j < i); j++) {
- for(k = 0; k < s; k++) {
- if(c[k] != c[k + j*s]) {
- ano = 0;
- break;
- }
- }
- }
- if(ano)
- max = i;
- }
- printf("%d\n", max);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement