#K63872. Minimum Operations to Palindrome

    ID: 31850 Type: Default 1000ms 256MiB

Minimum Operations to Palindrome

Minimum Operations to Palindrome

You are given a string s consisting of lowercase English letters. Your task is to determine the minimum number of operations required to transform the string into a palindrome. In one operation, you can change a character at any position in the string.

A string is a palindrome if it reads the same forwards and backwards. Formally, a string s of length n is a palindrome if for all \(0 \leq i < n\), the following holds:

[ s[i] = s[n-i-1] ]

Input Constraints: \(1 \leq |s| \leq 10^5\).

Example: For the input "abca", one optimal sequence of operations is to change 'b' to 'c' (or 'c' to 'b'), resulting in "acca" or "abba" respectively. In both cases, a single operation is enough.

inputFormat

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

\(1 \leq |s| \leq 10^5\)

outputFormat

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

## sample
abca
1