You are given a string S of length N. If a string contains at least one character whose frequency is greater than or equal to the half of the length of the string, then the string is called superior.
You are required to find the length of the longest superior substring available in the given string S.
Note: Here half is considered under integer division i.e. 9/2=4 , 3/2=1 etc.
Input format
Output format
For each test case, print the length of the longest superior substring in a new line.
Constraints
1≤T≤10
1≤N≤105
The string S contains only lowercase English alphabets.
Sample test case 2: We can select the substring starting from index 1 to 13, here the frequency of b is 6 which is greater than or equal to 13/2=6.
Note that, there can be multiple possible substrings.