#include <iostream>
#include <cstring>
using namespace std;
int strPeriod(char *str){
int period;
period = strlen(str); //
for(int i=1; i<=(strlen(str)/2); i++){
int j;
for(j=0; j<strlen(str)-i; ){
if(str[j] == str[j+i]){
j++;
}
else{
break;
}
}
if(j == (strlen(str) - i)){
period = i;
break;
}
}
return period;
}
int main() {
const int n = 81;
int tests;
cin >> tests;
cin.ignore(1, ' ');
char *str = new char[n];
for(int j=0; j<tests; j++){
cin.getline(str, n);
cout << strPeriod(str);
if(j != tests - 1){
cout << endl << endl;
}
}
return 0;
}
ICAgICNpbmNsdWRlIDxpb3N0cmVhbT4KICAgICNpbmNsdWRlIDxjc3RyaW5nPgogICAgdXNpbmcgbmFtZXNwYWNlIHN0ZDsKICAgICAKICAgIGludCBzdHJQZXJpb2QoY2hhciAqc3RyKXsKICAgIAlpbnQgcGVyaW9kOwogICAgCXBlcmlvZCA9IHN0cmxlbihzdHIpOyAvLyAKICAgIAlmb3IoaW50IGk9MTsgaTw9KHN0cmxlbihzdHIpLzIpOyBpKyspewogICAgCQlpbnQgajsKICAgIAkJZm9yKGo9MDsgajxzdHJsZW4oc3RyKS1pOyApewogICAgCQkJaWYoc3RyW2pdID09IHN0cltqK2ldKXsKICAgIAkJCQlqKys7CiAgICAJCQl9CiAgICAJCQllbHNlewogICAgCQkJCWJyZWFrOwogICAgCQkJfQogICAgCQl9CiAgICAgCWlmKGogPT0gKHN0cmxlbihzdHIpIC0gaSkpewogICAgCQkJCXBlcmlvZCA9IGk7CiAgICAJCQkJYnJlYWs7CiAgICAJCX0KICAgIAl9CiAgICAgCiAgICAJcmV0dXJuIHBlcmlvZDsKICAgIH0KICAgICAKICAgIGludCBtYWluKCkgewogICAgCWNvbnN0IGludCBuID0gODE7CiAgIAkJaW50IHRlc3RzOwogICAJCWNpbiA+PiB0ZXN0czsKICAgCQljaW4uaWdub3JlKDEsICcgJyk7CiAgICAJY2hhciAqc3RyID0gbmV3IGNoYXJbbl07CiAgICAJZm9yKGludCBqPTA7IGo8dGVzdHM7IGorKyl7CiAgICAJCWNpbi5nZXRsaW5lKHN0ciwgbik7CiAgICAJCWNvdXQgPDwgc3RyUGVyaW9kKHN0cik7CiAgICAJCWlmKGogIT0gdGVzdHMgLSAxKXsKICAgIAkJCWNvdXQgPDwgZW5kbCA8PCBlbmRsOwogICAgCQl9CiAgICAJfQogICAgCXJldHVybiAwOwogICAgfQ==