#K5656. Minimum Changes to Palindrome
Minimum Changes to Palindrome
Minimum Changes to Palindrome
Given a string s
, your task is to determine the minimum number of character changes required to transform s
into a palindrome. A palindrome is a string that reads the same forwards and backwards.
You can change any character into any other character. The minimum number of changes required is given by the formula:
\( \text{minChanges} = \sum_{i=0}^{\lfloor \frac{n-1}{2} \rfloor} \mathbf{1}_{\{s[i] \neq s[n-i-1]\}} \)
where \( n \) is the length of the string and \( \mathbf{1}_{\{condition\}} \) is 1 if the condition is true and 0 otherwise.
inputFormat
The input consists of a single line containing the string s
. The string contains only lowercase letters and its length can be up to \(10^5\).
outputFormat
Output a single integer which is the minimum number of changes required to convert the string into a palindrome.
## samplerace
2
</p>