#Lutece2843. Kanade Loves Symmetry
Kanade Loves Symmetry
Migrated from Lutece 2843 Kanade Loves Symmetry
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
Kanade really loves symmetrical things, like squares, circles, and the substring ana
in her name.
Now she has a string that only contains lowercase letters. She would like two swap two adjacent letters several times, to make this string be a palindrome. A palindrome is a string that reads the same backward as forward. madam
is a palindrome, while kanade
is not a palindrome.
She would like to know the minimum time(s) of the swap operation that will be performed to make this string a palindrome.
Input
Only one line. The only line contains only one string, consisting of lowercase letters.
Output
Output the minimum time(s) in one line. If the string can't be a palindrome, please output Impossible
.
Samples
aaaab
2
kanade
Impossible
ana
0
Note
In Sample 1, the swap operations are done as follows.
$$\texttt{aaaab}\to \texttt{aaaba} \to \texttt{aabaa} $$In Sample 3, she doesn't need to do the swap operation. So just output .
Resources
The 18th UESTC Programming Contest Preliminary