#C4235. Minimum Transformations to Palindrome

    ID: 47751 Type: Default 1000ms 256MiB

Minimum Transformations to Palindrome

Minimum Transformations to Palindrome

Given a string, a transformation is defined as changing one mismatched character in a pair of symmetric characters such that the string becomes a palindrome. In other words, for a string \( S \) of length \( n \), you need to calculate the number of mismatched pairs \( (S[i], S[n-i-1]) \) for \( 0 \leq i < \lfloor \frac{n}{2} \rfloor \).

The problem is to compute the minimum number of transformations required to convert the given string into a palindrome by fixing these mismatches.

inputFormat

The input is provided in the following format from stdin:

T
S1
S2
...
ST

Here, T is the number of test cases, and each Si is a string consisting only of lowercase English letters.

outputFormat

For each test case, output a single integer on a new line indicating the minimum number of transformations required to convert the given string into a palindrome. The output should be written to stdout.

## sample
3
abca
abcd
racecar
1

2 0

</p>