#C538. Minimum Operations to Palindrome
Minimum Operations to Palindrome
Minimum Operations to Palindrome
You are given a string s consisting of lowercase Latin letters. Your task is to determine the minimum number of character replacement operations required to transform the string into a palindrome.
A palindrome is a string that reads the same forwards and backwards. In each operation, you can choose one character in the string and replace it with any other lowercase letter.
The minimum number of operations is given by the number of indices i that satisfy:
\( s[i] \neq s[n-i-1] \) for \( 0 \le i < \lfloor \frac{n}{2} \rfloor \)
For example, given the string abc
, only one change is needed (change either the first or last character) to make it a palindrome.
inputFormat
The input consists of a single line containing a non-empty string s of lowercase Latin letters.
Input is provided via standard input.
outputFormat
Output a single integer representing the minimum number of replacement operations needed to transform the input string into a palindrome.
Output should be printed to standard output.
## sampleabccba
0