Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- int main()
- {
- char str[5][100010];
- for(int i = 0 ; i < 5 ; i ++){
- scanf("%s",str[i]);
- }
- for(int T = 0 ; T < 5 ; T ++){
- int n = strlen(str[T]);
- int cnt = 0;
- for(int size = 1 ; size <= n ; size ++){
- if(n % size != 0)continue;
- int nextcmp = size;
- bool check = true;
- while(nextcmp < n && check){
- int i;
- for(i = 0 ; i < size && check; i ++){
- if(str[T][i] != str[T][i+nextcmp]){
- check = false;
- }
- }
- nextcmp += size;
- }
- if(check){
- cnt++;
- }
- }
- printf("%d\n",cnt);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment