Problem M
Alchemy
You just finished day one of your alchemy class! For your alchemy homework, you have been given a string of lowercase letters and wish to make it a palindrome. You’re only a beginner at alchemy though, so your powers are limited. In a single operation, you may choose exactly two adjacent letters and change each of them into a different lowercase letter. The resulting characters may be the same as or different from one another, so long as they were both changed by the operation.
Formally, if the string before the operation is
Compute the minimum number of operations needed to make the string a palindrome.
Input
The single line of input contains a string of
Output
Output a single integer, which is the minimum number of operations needed to make the string a palindrome.
Sample Input 1 | Sample Output 1 |
---|---|
ioi |
0 |
Sample Input 2 | Sample Output 2 |
---|---|
noi |
1 |
Sample Input 3 | Sample Output 3 |
---|---|
ctsc |
1 |
Sample Input 4 | Sample Output 4 |
---|---|
fool |
2 |
Sample Input 5 | Sample Output 5 |
---|---|
vetted |
2 |