#C4441. Almost Palindrome Check
Almost Palindrome Check
Almost Palindrome Check
In this problem, you are given a string s. Your task is to determine whether the string can be transformed into a palindrome by removing at most one character.
A palindrome is a sequence which reads the same forward and backward, i.e., \( s = s^R \). For example, the string "racecar" is already a palindrome. However, the string "abca" becomes a palindrome if you remove the character 'b' (or 'c').
You need to output True
if the string is already a palindrome or can be made into one by removing at most one character, and False
otherwise.
inputFormat
The input consists of a single line containing the string \( s \) to be checked.
Note: The string will not contain any leading or trailing spaces.
outputFormat
Output a single line with either True
or False
indicating whether the string can be transformed into a palindrome by removing at most one character.
abca
True