Smallest Repeating Block
You are given T strings. For each string s, find the length of the shortest non-empty string t such that s is equal to t written k times in a row, for some positive integer k.
Such a t always exists, because t = s with k = 1 works. So if s cannot be split into two or more identical copies of a shorter block, the answer is the length of s.
Input
The first line contains an integer T (1 ≤ T ≤ 10^5), the number of strings.
Each of the next T lines contains a string s of lowercase English letters with 1 ≤ |s|. The total length of all strings is at most 10^6.
Output
For each string, print the length of its shortest repeating block on its own line, in input order.
Notes
In the first example, abcabcabc is abc written three times, so the answer is 3. abab can be written as ab twice, so the answer is 2. abaab cannot be split into equal blocks: ab matches the start and the end, but the length 5 isn't a multiple of 2, so the answer is 5. zzzzzz is z written six times.
In the second example, aabaab is aab written twice. In abaaba, the shortest block is aba (written twice), even though aba itself starts and ends with a. In abcab, no shorter block works, so the answer is 5.