#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
string s,k;
cin>> n;
while(n--){
cin>> s;
k="";
for(int i=0;i<s.size();i++){
k+=s[i];
if(s.size()%k.size()==0){
int t=s.size()/k.size();
string k2;
for(int j=0;j<t;j++){
k2+=k;
}
if(k2==s){
cout<< k.size();
i=s.length();
if(n==1){
cout<<endl;
}
}
}
}
}
}