eolymp
bolt
Try our new interface for solving problems
Problems

Palindrome

Palindrome

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.

Time limit 1 second
Memory limit 128 MiB
Input example #1
abab
Output example #1
1
Input example #2
abc
Output example #2
-1
Source 2014 KBTU Open, Spring Kazakhstan, Almaty, April 20, Problem H