#K95747. One Transform Palindrome Check
One Transform Palindrome Check
One Transform Palindrome Check
Given a string s consisting only of lowercase English letters, determine whether it is possible to transform s into a palindrome by performing at most one transformation (i.e. by replacing at most one character). A string is a palindrome if it reads the same forwards and backwards. Mathematically, let \( mismatches \) be the number of pairs \((s[i], s[n-1-i])\) such that \( s[i] \neq s[n-1-i] \). The answer is True
if \( mismatches \leq 1 \) and False
otherwise.
Note that if the input string is already a palindrome, then the answer is True
since no transformation is needed.
inputFormat
The input is given from standard input (stdin) and consists of a single line containing the string s.
Constraints:
1 \(\leq\) length of s \(\leq 10^5\),
s consists only of lowercase English letters.
outputFormat
Output to standard output (stdout) a single line: True
if the string can be transformed into a palindrome with at most one transformation, or False
otherwise.
abca
True
</p>