#C1625. Minimum Operations to Palindrome

    ID: 44851 Type: Default 1000ms 256MiB

Minimum Operations to Palindrome

Minimum Operations to Palindrome

You are given a string s. In one operation, you can change any character of s to any other character. Your task is to determine the minimum number of operations required to transform the string into a palindrome.

Definition: A string is called a palindrome if it reads the same backward as forward. For a string of length n, you only need to consider the first ⌊n/2⌋ characters; for each position i (0-based indexing), if s[i] does not match s[n-i-1], one operation is required to make them equal.

The input consists of multiple test cases. For each test case, you are given a single string. For each string, output the minimum number of operations needed.

inputFormat

The first line of input contains an integer T indicating the number of test cases.

Each of the following T lines contains a single string s comprised of lowercase English letters.

Input is read from standard input (stdin).

outputFormat

For each test case, output a single integer on a new line — the minimum number of operations required to transform the string into a palindrome.

Output the answer to standard output (stdout).

## sample
3
ab
racecar
abcd
1

0 2

</p>