# FOJ Problem 1011 Power Strings

## Problem Description

Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of concatenation as multiplication, exponentiation by a non-negative integer is defined in the normal way: a^0 = "" (the empty string) and a^(n+1) = a*(a^n).

Each test case is a line of input representing s, a string of printable characters. For each s you should print the largest n such that s = a^n for some string a. The length of s will be at least 1 and will not exceed 1 million characters. A line containing a period follows the last test case.

abcd
aaaa
ababab
.

## Sample Output

1
4

//求最小周期串，得出最小周期串的总个数
# include "stdio.h"
# include "string.h"
char a[1000100];
int main()
{
int i, j, k;
int length;
int flage;
while(scanf("%s", a))
{
if(a[0]=='.')
{
break;
}
length=strlen(a);
for(i=1; i<=length; i++)//枚举周期串长度
{
if(length%i==0)
{
flage=1;
for(k=i; k<=length-1; k++)
{
if(a[k%i]!=a[k])
{
flage=0;
break;
}
}
if(flage)
{
printf("%d\n", length/i);
break;
}
}
}
}
return 0;
}



01-20 251
08-02 711
09-05 392
10-08 705
03-29 578
08-17 1943
09-07 15
09-24 336
07-30 28
06-09 31
08-24 2297