Sample Input
abcd
aaaa
ababab
.
Sample Output
1 //1个abcd
4 //4个a
3 //3个ab
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
using namespace std; const int MAXN=;
char T[MAXN];
int next[MAXN];
int n;
void getNext()
{
int j,k;
j=;
k=-;
next[]=-;
while(j < n)
{
if(k==-||T[j]==T[k])
{
j++;
k++; next[j]=k;
}
else k=next[k]; }
if(n%(n-k)==)
printf("%d\n",n/(n-k));
else
printf("1\n") ;
}
int main()
{ while(scanf("%s",&T) != EOF)
{
if (T[]=='.')
break ;
n = strlen(T) ;
getNext(); }
return ;
}