This is a problem from previous contest : https://www.hackerearth.com/practice/algorithms/searching/binary-search/practice-problems/algorithm/superior-substring-dec-circuits-e51b3c27/

Problem-Statement :—>

You are given a string of length .

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 .

Note: Here half is considered under integer division i.e. , etc.

Input format

First line: Integer ‘t’ that represents the total number of test cases

For each test case:

First line: Integer ‘n’ that represents the length of the string

Next line: String ‘S’ of the length ‘N’

Output format :

For each test case, print the length of the longest superior substring in a new line.

Constraints :

1<=T<=10

1<=N<=10^5

The string contains only lowercase English alphabets.