Given a string, what is the minimum number of adjacent swaps required to convert a string into a palindrome? If not possible, return -1.
Example 1
Inputmamad
Output3
Explanation
swap m with a => maamd
swap m with d => maadm
swap a with d => madam
Example 2
Inputasflkj
Output-1
Example 3:
Inputmideld
Output3
Explanation
swap e with l => midled
swap e with d => midlde
swap l with d => middle