[CF2290D] 字母降格 (Letters Down)
Problem Statement
You are given a string of length consisting of lowercase English letters.
In one operation, you may choose any lowercase letter and replace all occurrences of in with the immediately preceding letter in the alphabet (for example, changing every 'c' to 'b'). If does not appear in , the string remains unchanged.
Find the minimum number of operations required to turn into a palindrome.
Input
The first line contains () — the number of test cases.
Each test case consists of () on the first line, and the lowercase string of length on the second line.
It is guaranteed that the sum of over all test cases does not exceed .
Output
For each test case, print a single integer — the minimum number of operations to make a palindrome.
Example
5
4
abca
4
abdc
7
racecar
4
cbad
4
zaza
1
3
0
2
25
Note
- Constraints: , , .
- Source: Codeforces 2290D · Letters Down