#include <stdio.h>
#include <string.h>
char s[90];
int main() {
int n, m, b;
scanf("%d%c", &n, &s[0]);
while (n-- && getchar() && ((m = strlen(gets(s))) != 0))
for (int i = 1; i <= m && !(b = 0); i++)
if (m % i == 0) {
for (int j = i; j < m; j++)
if (b = (s[j] != s[j % i])) break;
if (b) continue;
printf("%d\n%s", i, n ? "\n" : "");
break;
}
return 0;
}
UVA 455 Periodic Strings 18行代码AC
最新推荐文章于 2024-07-12 18:56:03 发布