


The first line contains an integer 'T' which denotes the number of test cases or queries to be run. Then, the T test cases follow.
The first and only line of each test case or query contains the string STR.
For each test case, print the count of minimum characters needed in a separate line.
You do not need to print anything, it has already been taken care of. Just implement the given function.
1 <= T <= 10
1 <= N <= 10 ^ 5
STR contains only lowercase English letters.
Time limit: 1 sec
Note: We can easily find LPS array, using Algorithm for LPS(Prefix Function).