#include<bits/stdc++.h>
using namespace std;
#define MAXN 100009
int F[MAXN];
int FailureFunction(char* str)
{
int N = strlen(str);
int j = 0;
for(int i = 2;i<=N;i++)
{
while(j>0&&str[i-1]!=str[j])
j = F[j];
if(str[i-1]==str[j])
j+=1;
F[i] = j;
}
return F[N];
}
int main()
{
int tc,cs;
char str[MAXN];
while(scanf(" %s",str)){
if(str[0]=='.')break;
int len=strlen(str);
int tmp=FailureFunction(str);
if(len%(len-tmp)==0) printf("%d\n",len/(len-tmp));
else printf("1\n");
}
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2RlZmluZSBNQVhOIDEwMDAwOQppbnQgRltNQVhOXTsKaW50IEZhaWx1cmVGdW5jdGlvbihjaGFyKiBzdHIpCnsKICAgIGludCBOID0gc3RybGVuKHN0cik7CiAgICBpbnQgaiA9IDA7CiAgICBmb3IoaW50IGkgPSAyO2k8PU47aSsrKQogICAgewogICAgICAgIHdoaWxlKGo+MCYmc3RyW2ktMV0hPXN0cltqXSkKICAgICAgICAgICAgaiA9IEZbal07CiAgICAgICAgaWYoc3RyW2ktMV09PXN0cltqXSkKICAgICAgICAgICAgais9MTsKICAgICAgICBGW2ldID0gajsKICAgIH0KICAgIHJldHVybiBGW05dOwp9CmludCBtYWluKCkKewogICAgaW50IHRjLGNzOwogICAgY2hhciBzdHJbTUFYTl07CiAgICB3aGlsZShzY2FuZigiICVzIixzdHIpKXsKICAgIGlmKHN0clswXT09Jy4nKWJyZWFrOwogICAgaW50IGxlbj1zdHJsZW4oc3RyKTsKICAgIGludCB0bXA9RmFpbHVyZUZ1bmN0aW9uKHN0cik7CiAgICBpZihsZW4lKGxlbi10bXApPT0wKSBwcmludGYoIiVkXG4iLGxlbi8obGVuLXRtcCkpOwogICAgZWxzZSBwcmludGYoIjFcbiIpOwogICAgfQogICAgcmV0dXJuIDA7Cn0K