#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
using namespace std;
const int N = 1e6+5;
int nxt[N];
int cnt = 0;
char s1[N], s2[N];
void GetNext(char s[], int length)
{
int i=0, j=-1;
nxt[0] = -1;//必须有...
while(i < length){
if(j == -1 || s[i] == s[j]){
i++;
j++;
nxt[i] = j;
}
else j = nxt[j];
}
}
int KMP(char s1[], int n, char s2[], int m)
{
int i = 0, j = 0;
while(i < n){
if(j == -1 || s1[i] == s2[j]){
i++;
j++;
}
else
j = nxt[j];
if(j == m){
cnt++;
j = i+1;//用过的根据题意不能再次检测
// j = nxt[j];
}
}
return cnt;
}
int main()
{
int n, cnt = 1;
while(1){
scanf("%s", s2);
n = strlen(s2);
if(s2[0] == '.')
break;
GetNext(s2, n);
int tmp = n-nxt[n];
if(n%tmp==0){
cout << n/tmp << endl;
}
else cout << 1 << endl;
}
return 0;
}