#C5014. Minimum Operations to Transform a String into a Palindrome

    ID: 48617 Type: Default 1000ms 256MiB

Minimum Operations to Transform a String into a Palindrome

Minimum Operations to Transform a String into a Palindrome

Given a string S, determine the minimum number of operations required to transform S into a palindrome. In one operation, you can change any character in the string to any other character. A string is a palindrome if it reads the same forwards and backwards, i.e., \(S = \text{reverse}(S)\). For instance, the string 'abca' can be converted into a palindrome with just 1 operation by changing either 'b' to 'c' or 'c' to 'b'.

The problem requires you to compute:

[ D = \sum_{i=0}^{\lfloor n/2 \rfloor - 1} \mathbb{1}(S[i] \neq S[n-i-1]) ]

where \(\mathbb{1}(\cdot)\) is the indicator function that equals 1 if the condition is true and 0 otherwise.

inputFormat

The input consists of a single line containing the string S. The string S contains only lowercase English letters. The length of the string is between 1 and 105.

outputFormat

Output a single integer representing the minimum number of operations required to make the string a palindrome.

## sample
abca
1

</p>