delete pics to save space
This commit is contained in:
36
2.455.cpp
Normal file
36
2.455.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
#include<cstdio>
|
||||
#include<cstring>
|
||||
#include<cctype>
|
||||
const int max=100+10;
|
||||
char s[max];
|
||||
int main()
|
||||
{
|
||||
int n, len;
|
||||
scanf("%d", &n);
|
||||
getchar();
|
||||
while (n--)
|
||||
{
|
||||
getchar();
|
||||
gets(s);
|
||||
len = strlen(s);
|
||||
for (int i = 1; i <= len;i++)
|
||||
if (len%i == 0)
|
||||
{
|
||||
bool ok = true;
|
||||
for (int j = i; j < len;j++)
|
||||
if (s[j] != s[j%i])
|
||||
{
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
if (ok)
|
||||
{
|
||||
printf("%d\n", i);
|
||||
if (n)
|
||||
putchar('\n');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user