#C8813. Valid Palindrome with One Removal
Valid Palindrome with One Removal
Valid Palindrome with One Removal
Given a string s
, determine if it can be transformed into a palindrome by removing at most one character. A string is considered a palindrome if it reads the same backwards and forwards, i.e. if \(s = \text{reverse}(s)\). For instance, the string "abca" can be transformed into "aba" by removing the character 'c'.
Your task is to print True
if the string can be transformed into a palindrome by removing at most one character, and False
otherwise.
inputFormat
The input is read from stdin and consists of a single line containing the string s
(with length at least 1 and up to \(10^5\)).
outputFormat
Print a single line to stdout: True
if the string can be transformed into a palindrome by removing at most one character, otherwise False
.
abca
True