A string of length n is called palindrome string if character at ith position is equal to character at (n-i+1)th position (1<= i <=ceil(n/2)).
But Jax likes the strings which does not follow the rules of Palindromic stings. Jax likes the strings that follows given two conditions:
1) The character at ith position should not be equal to (n-i+1)th character for any i (1 <= i <= ceil(n/2)) (1-based indexing).
2) The first condition should be true for all possible strings of same length that can be produced from given string after shuffling the string in any order.
You can perform a operation any number of times (possibly 0) so that Jax likes the given string.
The operation is that you can change any character to its adjacent character in alphabetic order and it costs you 1 unit. The alphabetic order is cyclic in nature i.e. âzâ and âaâ are adjacent to each other.
You have to find the minimum number of units so that given string is Un palindrome or say that it is impossible to do it by returning -1.