Find the absolute difference between the characters
int D1 = Math . max ( s . charAt ( i ) , s . charAt ( len - 1 - i ) ) - Math . min ( s . charAt ( i ) , s . charAt ( len - 1 - i ) ) ; int D2 = 26 - D1 ;