//https://www.hackerrank.com/challenges/the-love-letter-mystery
//See: https://www.hackerrank.com/contests/w3/challenges/the-love-letter-mystery
import java.io.*;

public class Solution {

    public static void main(String[] args) throws IOException {
        StringBuffer sb = new StringBuffer();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        for(byte t = Byte.parseByte(br.readLine()); t > 0; --t){

            int numOps = 0;
            char[] str = br.readLine().toCharArray();

            for(short i = 0, j = (short)(str.length-1); i < j; ++i, --j){
                numOps += str[i] < str[j] ? str[j] - str[i] : str[i] - str[j];
            }

            sb.append(numOps + "\n");
        }

        System.out.print(sb);
    }
}
@@ -64,13 +64,8 @@
 %0D%0A//
-See: 
 http
@@ -183,18 +183,16 @@
 on %7B%0D%0A%0D%0A
-  
   public
@@ -246,20 +246,16 @@
 tion %7B%0D%0A
-    
     Stri
@@ -285,28 +285,24 @@
 gBuffer();%0D%0A
-    
     Buffered
@@ -364,30 +364,56 @@
 stem.in));%0D%0A
+    
 %0D%0A    
+//For each test case%0D%0A
     for(byte
@@ -462,24 +462,30 @@
  --t)%7B%0D%0A
+      
 %0D%0A      
       in
@@ -480,42 +480,32 @@
     
-      int numOps = 0;%0D%0A  
+//Get input%0D%0A
       
-   
+final
  cha
@@ -544,24 +544,30 @@
 ray();%0D%0A
+      
 %0D%0A      
       fo
@@ -554,24 +554,56 @@
     %0D%0A      
+//Solve%0D%0A      int numOps = 0;%0D%0A
       for(sh
@@ -651,87 +651,34 @@
  j; 
-++i, --j)%7B%0D%0A                numOps += str%5Bi%5D %3C str%5Bj%5D ? str%5Bj%5D - str%5Bi%5D : 
+numOps += Math.abs(
 str%5Bi
+++
 %5D - 
@@ -686,18 +686,23 @@
 tr%5Bj
-%5D;
+--%5D))%7B%7D
 %0D%0A      
     
@@ -697,33 +697,40 @@
 %0D%0A      
+%0D%0A
       
-%7D%0D%0A%0D%0A      
+//Print output%0D%0A
       sb
@@ -762,21 +762,11 @@
     
-    %7D%0D%0A%0D%0A    
+%7D%0D%0A
     
@@ -792,12 +792,12 @@
 );%0D%0A
-  
   %7D%0D%0A%7D
+%0D%0A

Update the-love-letter-mystery.java