Palindrome
Very hard
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Given string. In one operation you can swap any two letters. Find minimum number of operations needed in order to receive palindrome or -1 if it is impossible.
Input
First line contains one string s (1 ≤ |s| ≤ 1000). Given string is not empty and only contains small latin letters.
Output
Print the minimum number of operations needed in order to receive palindrome or -1 if it is impossible.
Examples
Input #1
Answer #1
Input #2
Answer #2
Submissions 225
Acceptance rate 2%