#K52987. Can Form Palindrome
Can Form Palindrome
Can Form Palindrome
Given a string \( s \), determine whether it is possible to make \( s \) a palindrome by removing (or effectively replacing) at most one character. A palindrome is defined as a string that reads the same forwards and backwards, i.e., \( s = s^R \) where \( s^R \) denotes the reverse of \( s \).
If \( s \) is already a palindrome, the answer is True. Otherwise, you are allowed to remove one character from \( s \) and then check if the resultant string is a palindrome.
inputFormat
The input consists of a single line containing the string \( s \). The string may be empty and its length can be up to \( 10^5 \) characters.
outputFormat
Output a single line containing either True
or False
, indicating whether the string can be turned into a palindrome by removing at most one character.
abca
True