#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> #define MAX 10000 int main() { int T,sum,diff,l,r; char S[MAX]; scanf("%d",&T); while(T--) { scanf("%s",S); sum=0; l=0; r=strlen(S)-1; while(l<r) { diff=abs(S[r]-S[l]); sum+=diff; l++; r--; } printf("%d\n",sum); } return 0; }