#K9766. Minimum Replacements to Make String Symmetric
Minimum Replacements to Make String Symmetric
Minimum Replacements to Make String Symmetric
You are given a string \(s\) consisting of lowercase English letters. Your task is to compute the minimum number of character replacements required so that the string becomes symmetric (i.e. a palindrome).
A string is symmetric if for all \(0 \le i < n/2\), the following holds:
[ s[i] = s[n-i-1] ]
For example, for the string "abca", replacing the character at index 1 or index 2 will yield a symmetric string, hence the answer is 1.
Input: A single string \(s\) read from standard input.
Output: An integer denoting the minimum number of replacements needed.
inputFormat
The input is a single line containing the string (s) consisting only of lowercase English letters. The string may be of any length from 1 to (10^5).
outputFormat
Output a single integer which is the minimum number of replacements needed to make the string symmetric.## sample
abca
1