//
时间复杂度很高的算法了, 总感觉这些题都能用DP做
//
#include<iostream>
#include<cstdio>
#include<string.h>
#include<string>
using namespace std;
const int maxn = 80 + 5;
int main()
{
int T;
cin >> T;
char str[maxn];
string str1, str2;
while(T--)
{
scanf("%s", str+1);
int len = strlen(str+1);
for(int i = 1; i <= len; ++i)
{
str1.clear(); str2.clear();
if(len%i) continue;
for(int j = 1; j <= i; ++j) str1 += str[j];
bool ok = true;
for(int j=i+1; j <= len; ++j)
{
str2 += str[j];
if((j-i)%i == 0)
{
if(str1 == str2) { str2.clear(); continue;}
else {ok = false; break;}
}
}
if(ok) { cout << i << endl; break;}
}
if(T) cout << "\n";
}
return 0;
}