/*
自己没找出来,示例能过,请高手挑错,谢谢!
代码(C++):
*/
#include <iostream>
using namespace std;
int main()
{
int N=0;
cin>>N;
for(int i=0;i<N;i++)
{
string str="",period="";
// do
{
cin>>str;
}
while(str=="");
for(int j=0;j<str.size();j++)
{
if(str[j]==' ')
{
string temp="";
for(int k=0;k<j;k++)
temp+=str[k];
str=temp;
}
}
//int count=0;
period=str[0];
for(int j=1;j<str.size();j++)
{
if(str[j]!=period[j%period.size()])
{
for(int k=period.size();k<=j;k++)
period+=str[k];
}
}
if(str.size()%period.size()!=0)
cout<<str.size();
else
cout<<period.size();
cout<<endl;//<<endl;
if(i!=N-1)
cout<<endl;
}
return 0;
}
自己没找出来,示例能过,请高手挑错,谢谢!
代码(C++):
*/
#include <iostream>
using namespace std;
int main()
{
int N=0;
cin>>N;
for(int i=0;i<N;i++)
{
string str="",period="";
// do
{
cin>>str;
}
while(str=="");
for(int j=0;j<str.size();j++)
{
if(str[j]==' ')
{
string temp="";
for(int k=0;k<j;k++)
temp+=str[k];
str=temp;
}
}
//int count=0;
period=str[0];
for(int j=1;j<str.size();j++)
{
if(str[j]!=period[j%period.size()])
{
for(int k=period.size();k<=j;k++)
period+=str[k];
}
}
if(str.size()%period.size()!=0)
cout<<str.size();
else
cout<<period.size();
cout<<endl;//<<endl;
if(i!=N-1)
cout<<endl;
}
return 0;
}




