
#include <cstdio>
#include <cstring>
#define N 1000000 + 10
char a[N];
int next[N];
void getNext(int len){
    next[0] = -1;
    int j = -1,i = 0;
    while (i < len) {
        if (j == -1 || a[i] == a[j]) {
            i ++;
            j ++;
            next[i] = j;
        }
        else j = next[j];
    }
}

int main()
{
    while (scanf("%s",a)) {
        if (a[0] == '.') {
            break;
        }
        int len = strlen(a);
        getNext(len);
        if (len % (len - next[len] == 0)) {
            printf("%d\n",len / (len - next[len]));
        }else {
            printf("1\n");
        }
    }
    return 0;
}