#C6123. Minimum Operations to Palindrome

    ID: 49849 Type: Default 1000ms 256MiB

Minimum Operations to Palindrome

Minimum Operations to Palindrome

You are given an integer ( n ) and a string ( s ) of length ( n ) consisting of lowercase letters. Your task is to determine the minimum number of operations required to transform ( s ) into a palindrome. A string is a palindrome if for every index ( i ) in the range ( 0 \leq i < n ), the condition ( s[i] = s[n-i-1] ) holds. In one operation, you can change a single character. The answer is the number of indices ( i ) with ( 0 \leq i < \lfloor n/2 \rfloor ) where ( s[i] ) differs from ( s[n-i-1] ).

inputFormat

The input is given via STDIN. The first line contains an integer ( n ) representing the length of the string. The second line contains the string ( s ) consisting of exactly ( n ) lowercase letters.

outputFormat

Print a single integer via STDOUT — the minimum number of operations required to transform ( s ) into a palindrome.## sample

3
abc
1

</p>