In order to celebrate Women's day, Stella started playing with string S. She needs to know the maximum number of characters between any 2 same characters in the string.
As she is busy in playing, help her for the same.
If there are no 2 same characters in the string, print 1.
Note: String is composed of lowercase letters of the Latin alphabet.
Input:
First line contains one integer T, denoting the number of test cases.
Each of the next T line contains one string S.
Output:
For each test case, output the maximum number of characters between any 2 same characters in the string. If there are no 2 same characters in the string, print 1.
Print answer for each test case in a new line.
Constraints:
\(1 \le T \le 10\)
\( 1 ≤ |S| ≤ 10^5\), where S determines the length of the string.
String is composed of lowercase alphabets ranging from a to z.