#include<cstdio>
#include<cstring>
using namespace std;
const int N=1e6+10;
int n,next[N];char s[N];
int main()
{
freopen("powerstrings.in","r",stdin);
freopen("powerstrings.out","w",stdout);
while (1){
scanf("%s",s+1);
if (s[1]=='.') break;
n=strlen(s+1);
for (int i=2;i<=n;i++){
int j=next[i-1];
while (j&&s[j+1]!=s[i]) j=next[j];
next[i]=(s[j+1]==s[i]?j+1:j);
}
int i=next[n];
while (i&&n%(n-i)) i=next[i];
printf("%d\n",n/(n-i));
}
return 0;
}