#K58562. Almost Palindrome
Almost Palindrome
Almost Palindrome
This problem asks you to determine whether a given string is an almost palindrome. A string is considered almost a palindrome if it is already a palindrome or it can become a palindrome by removing exactly one character. Before the check, you should remove all non-alphanumeric characters and convert the string to lowercase. Note that the removal of a character must be performed at most once.
The palindrome property means that the string reads the same forwards and backwards.
For example:
radkar
becomes a palindrome if thed
is removed.Race, Car
becomes a palindrome after cleaning to racecar.abc
cannot be turned into a palindrome by removing just one character.
You are required to read input from stdin
and output the result to stdout
as either True
or False
.
inputFormat
The input consists of a single line containing a string s, which may include spaces and punctuation.
You should read the input from stdin
.
outputFormat
Output a single line: True
if the string is almost a palindrome; otherwise, output False
to stdout
.
radkar
True