#include <iostream>
using namespace std;
int main(){
string a;
while(cin >> a, a != ".") {
for(int i = a.size(); i; i--) {
if(a.size()%i == 0) {
int m = a.size() / i;
string str, newStr;
str = a.substr(0, m);
for(int j = 0; j < i; j++) newStr+=str;
if(newStr==a) {
cout << i << endl;
break;
}
}
}
}
return 0;
}