#include <iostream>
using namespace std;
int main(void)
{
string s;
while (cin >> s) {
if (s == ".") break;
bool flag;
int n = s.size();
for (int i = 1; i <= n; i++) {
flag = false;
for (int j = 0; j < n; j++) {
if (s[j] != s[j%i]) {
flag = true;
break;
}
}
if (!flag) {
cout << n / i << endl;
break;
}
}
if (flag) puts("-1");
}
return 0;
}