#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn=1000002;
char s[maxn];
int n,m,next[maxn];
void NEXT()
{
int i,j=0;
memset(next,0,sizeof(next));
for(i=1;i<n;i++)
{
j=next[i-1];
while(j&&s[i]!=s[j])j=next[j-1];
if(s[i]==s[j])
{
next[i]=j+1;
}else next[i]=0;
}
}
int main()
{
//freopen("//media/学习/ACM/input.txt","r",stdin);
while(scanf("%s",s)&&s[0]!='.')
{
n=strlen(s);
int i,j;
NEXT();
if(n%(n-next[n-1])==0)
{
printf("%d\n",n/(n-next[n-1]));
}else cout<<1<<endl;
}
return 0;
}