Make Palindrome
54% Success5245 Attempts20 Points1s Time Limit256MB Memory1024 KB Max Code

There is a string that consists of lowercase english alphabets and we have to make the string a palindrome
For this, we have \(2\) types of operations
1. Re-arrange the string however you want (this operation is free)
2. Add a new character to the end of the string (this operation will cost 1Re)

Your task is to calculate the minimum amount of money to make the string a palindrome

Input Format:
The first line contains one integer \(T\) the number of test cases
The first line of every test case consists of \(N\), the length of the string
The second line of every test case contains string \(S\)


Output Format:
For every test case output one integer, the minimum amount of money required to make the string a palindrome

Constraints:

\(1 \leq T \leq 100\)
\(1 \leq N \leq 10^5\)

Examples
Input
1
4
aabb
Output
0
Explanation

Here we can re-arrange the string as abba , we need no extra characters to make this a palindrome

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading Editor...
Results