#C9545. Minimum Operations to Palindrome

    ID: 53650 Type: Default 1000ms 256MiB

Minimum Operations to Palindrome

Minimum Operations to Palindrome

Given a string S of length n, determine the minimum number of operations required to transform S into a palindrome. In one operation, you can change any character to any other character.

The problem can be simplified by observing that for a string to be palindromic, its first character must match its last character, its second character must match its second-to-last character, and so on. Formally, if we define the number of operations as

$$\text{operations} = \sum_{i=0}^{\lfloor\frac{n}{2}\rfloor - 1} \mathbf{1}_{\{s[i] \neq s[n-i-1]\}},$$

then your task is to compute this value for the input string.

inputFormat

The input consists of a single line containing the string S.

outputFormat

Output a single integer: the minimum number of operations required to convert S into a palindrome.

## sample
racecar
0