#include<bits/stdc++.h>
using namespace std;
bool yorn(string sub,string s){
int len1=sub.size();
int len2=s.size();
int cnt=0;
for(int j=0;j<len2;++j){
if(sub[cnt]==s[j])cnt++;
else return 0;
if(cnt==len1)cnt=0;
}
if(cnt==0)return 1;
else return 0;
}
main(){
int n;
cin>>n;
while(n--){
//char s[100005];
//scanf("\n%s",&s);
string s;
getchar();
cin>>s;
string sub;
char c=s[0];
sub=c;
for(int i=1;i<=s.size();++i){
if(yorn(sub,s)==1){cout<<sub.size()<<endl<<endl;break;
}
else sub+=s[i];
}
//cout<<sub.size()<<endl;
}
}