#C6320. Valid Palindrome by Removing At Most One Character
Valid Palindrome by Removing At Most One Character
Valid Palindrome by Removing At Most One Character
You are given a string s
. You need to determine if it is possible to make s
a palindrome by removing at most one character from it.
A palindrome is a string that reads the same forwards and backwards (e.g. "racecar"
or "abba"
).
For example, given the string "abca"
, by removing the character 'c'
(or 'b'
), the resulting string "aba"
(or "aca"
) is a palindrome.
If the string is already a palindrome, it is considered valid.
Note: The string may be empty or consist of a single character, both of which are palindromes by definition.
inputFormat
The input consists of a single line containing the string s
(which may include spaces and punctuation).
You should read the input from the standard input (stdin).
outputFormat
Output True
if the string can be made into a palindrome by removing at most one character; otherwise, output False
.
The result should be printed to standard output (stdout).
## sampleracecar
True