word of lowercase English letters. In one move you may swap two **adjacent** letters.
Return the smallest number of moves that turns the string into a palindrome (it reads the same left to right and right to left). The letters of word are guaranteed to form some palindrome.word="xyxy" → 1
Swap the last two letters: "xyxy" → "xyyx". One swap is enough.
word="mamad" → 3
For instance "mamad" → "maamd" → "maadm" → "madam": three swaps, and no fewer will do.
word="noon" → 0
word consists of lowercase English lettersword can be arranged into a palindromeword="xyxy"
1
Run checks the first 3 tests in your browser. Submit checks all 70 tests on the server, hidden ones included.