print?#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int maxn=1e6+9;
int next[maxn];
char a[maxn];
int main()
{
while(1)
{
memset(a,0,sizeof(a));
scanf("%s",a+1);
if(a[1]=='.') break;
next[1]=0;
int n=strlen(&a[1]);
for(int i=2;i<=n;i++)
{
int t=i-1;
while(t&&a[i]!=a[next[t]+1])
t=next[t];
next[i]=next[t]+(a[i]==a[next[t]+1]);
}
int ans=n-next[n];
if(n%ans)
printf("1\n");
else
printf("%d\n",n/ans);
}
return 0;
}
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int maxn=1e6+9;
int next[maxn];
char a[maxn];
int main()
{
while(1)
{
memset(a,0,sizeof(a));
scanf("%s",a+1);
if(a[1]=='.') break;
next[1]=0;
int n=strlen(&a[1]);
for(int i=2;i<=n;i++)
{
int t=i-1;
while(t&&a[i]!=a[next[t]+1])
t=next[t];
next[i]=next[t]+(a[i]==a[next[t]+1]);
}
int ans=n-next[n];
if(n%ans)
printf("1\n");
else
printf("%d\n",n/ans);
}
return 0;
}