标签:int 子串 pac namespace using type out 循环 size
int compare( size_type index, size_type length, const basic_string &str, size_type index2,size_type length2 );
#include<iostream>
#include<string>
using namespace std;
int main(){
int n;
cin>>n;
for(int j=0;j<n;j++){
string a;
cin>>a;
int i,k;
for(i=1;i<=a.length();i++)//i为循环节长度
if(a.length()%i==0){
for(k=i;k<a.length()&&a.compare(0,i,a,k,i)==0;k+=i);
if(k>=a.length()){
cout<<i<<endl;
break;
}
}
if(j<n-1)cout<<endl;
}
return 0;
}
标签:int 子串 pac namespace using type out 循环 size
原文地址:https://www.cnblogs.com/jsdtxm/p/9459997.html