#C8258. Minimum Operations to Make a String Symmetrical

    ID: 52220 Type: Default 1000ms 256MiB

Minimum Operations to Make a String Symmetrical

Minimum Operations to Make a String Symmetrical

Given a string ( s ) consisting of lowercase English letters, determine the minimum number of operations required to make ( s ) symmetrical (i.e. a palindrome). In one operation, you may change a character to any other character. Formally, you need to compute: [ \text{Operations} = \sum_{i=0}^{\lfloor \frac{n}{2} \rfloor - 1} \mathbf{1}{{s[i] \neq s[n-i-1]}}, ] where ( n ) is the length of the string, and ( \mathbf{1}{{\cdot}} ) is the indicator function. For example, the string "abca" requires 1 operation (change the second character) to become symmetrical.

inputFormat

The input consists of a single line containing a string ( s ) of lowercase English letters. The string may be empty.

outputFormat

Output a single integer representing the minimum number of operations required to transform ( s ) into a symmetrical string.## sample

abca
1

</p>