#K14321. Minimum Changes to Palindrome

    ID: 24109 Type: Default 1000ms 256MiB

Minimum Changes to Palindrome

Minimum Changes to Palindrome

You are given an integer n and a string s consisting of lowercase English letters. Your task is to determine the minimum number of changes required to transform s into a palindrome.

A change is defined as modifying a single character. In other words, for each pair of characters at positions i and n-i-1 (using 0-indexing), if they are different, one of them must be changed so that the two become identical. The goal is to minimize the total number of such changes.

The constraints are given by \(1 \leq n \leq 10^5\) for non-empty strings, and if n is zero, the answer is trivially 0.

inputFormat

The input consists of two lines:

  1. The first line contains an integer n, the length of the string.
  2. The second line contains the string s which is comprised of n lowercase English letters.

outputFormat

Output a single integer on a new line representing the minimum number of changes needed to convert the string s into a palindrome.

## sample
5
abcca
1