#include <stdio.h>
#include <string.h>
int main()
{
int T, k, len;
char str[81], *p, *q, *end;
scanf("%d", &T);
while (T--)
{
scanf("%s", str);
len = strlen(str);
end = str+len;
for (k = 1; k < len; ++k)
{
p = str;
q = str + k;
while (p < end && q < end)
{
if (*p != *q)
break;
++p, ++q;
}
if (q == end)
{
q = str;
while (p < end && q < end && *p++ == *q++);
if (p == end)
break;
}
}
printf("%d\n", k);
if (T) putchar('\n');
}
return 0;
}