#C4891. Minimum Operations to Make a Palindrome
Minimum Operations to Make a Palindrome
Minimum Operations to Make a Palindrome
You are given T test cases. For each test case, you are provided with an integer n denoting the length of a string S and the string S itself. Your task is to determine the minimum number of operations required to transform S into a palindrome.
In one operation, you can change any character of the string to any other character. A string S of length n is considered a palindrome if it satisfies the equation $$ S[i] = S[n-i-1] $$ for all $$ 0 \leq i < n $$.
If the string is already a palindrome, the answer is 0.
inputFormat
The input is given via stdin and has the following format:
- The first line contains an integer T, the number of test cases.
- For each test case, the first line contains an integer n, the length of the string.
- The next line contains the string S.
outputFormat
For each test case, output a single integer on a separate line representing the minimum number of operations required to convert the string into a palindrome.
## sample4
3
abc
4
abba
5
aabaa
6
abccba
1
0
0
0
</p>