#include<iostream>#include<string.h>#include<iomanip>#include<stdio.h>using namespace std;int main(void){char st[999];int n,len,p,i,k,d,co;? ? //find 1? ? cin>>n;? ? while(n--)? ? {? ? ? ? cin>>st;? ? ? ? len=strlen(st);? ? ? ? p=0;? ? ? ? co=1;? ? ? ? i=1;? ? ? ? d=0;? ? ? ? while(1)? ? ? ?{? ? ? ?p=0;? ? ? ? ? ?for(;i<len;i++)? ? ? ? ? ? if(st[i]==st[0]&&len%i==0){co=0;break;}if(i==1){i=1;break;}if(co){i=len;break;}//cout<<i<<endl;? ? ? ? ? ? for(k=i;k<len;k++)? ? ? ? ? ? if(st[k]!=st[k%i]){p=1;i=i+1;break;}? ? ? ? ? ? if(p)continue;? ? ? ? ? ? if(!p)break;? ? ? ? ? ? }? ? ? ? ? ? if(n>=1)cout<<i<<endl<<endl;? ? ? ? ? ? else cout<<i<<endl;? ? }? ? return 0;}
添加回答
舉報(bào)
0/150
提交
取消