**Problem Statement**

James found a love letter his friend Harry has written for his girlfriend. James is a prankster, so he decides to meddle with the letter. He changes all the words in the letter intopalindromes.

To do this, he follows two rules:

- He can reduce the value of a letter, e.g. he can change
*d*to*c*, but he cannot change*c*to*d*. - In order to form a palindrome, if he has to repeatedly reduce the value of a letter, he can do it until the letter becomes
*a*. Once a letter has been changed to*a*, it can no longer be changed.

Each reduction in the value of any letter is counted as a single operation. Find the minimum number of operations required to convert a given string into a palindrome.

**Input Format**

The first line contains an integer T , i.e., the number of test cases.

The nextT lines will contain a string each. The strings do not contain any spaces.

The next

**Constraints**

*length of string*

All characters are lower case English letters.

**Output Format**

A single line containing the number of minimum operations corresponding to each test case.

**Sample Input**

```
4
abc
abcba
abcd
cba
```

**Sample Output**

```
2
0
4
2
```

**Explanation**

- For the first test case, ab
**c**-> ab**b**-> aba. - For the second test case,
*abcba*is already a palindromic string. - For the third test case,
*abc*.**d**-> abc**c**-> abc**b**-> abc**a**= ab**c**a -> ab**b**a - For the fourth test case,
.**c**ba ->**b**ba -> aba

**Solution:**

#include<bits/stdc++.h> using namespace std; /* * * Prosen Ghosh * American International University - Bangladesh (AIUB) * */ string str; int main(){ int T; cin >> T; for(int t = 0; t < T; t++){ cin >> str; long long cnt = 0; /// if string size is odd you don't need to calculate middle value /// abc or cba calculate a and c u will find than minimum answer for(int i = 0,j = str.size()-1; i < str.size()/2 ;i++,j--)cnt+=abs(str[i]-str[j]); cout << cnt << endl; } return 0; }