#K36982. Palindrome Checker
Palindrome Checker
Palindrome Checker
Given a string s
, determine whether it is a palindrome. A palindrome is a word, phrase, number, or other sequence of characters that reads the same backward as forward after converting all letters to lower case and removing all non-alphanumeric characters. For example, "A man, a plan, a canal: Panama" is a palindrome because when cleaned, it reads the same forwards and backwards.
Your task is to implement a solution that reads a single line from standard input, checks whether the cleaned string is a palindrome, and prints True
or False
to standard output.
Note: Consider all non-alphanumeric characters as noise. Use the LaTeX format for any formulas if needed (e.g., $filtered = \text{lower}(\{c \in s : \text{isalnum}(c)\})$).
inputFormat
The input consists of a single line containing a string s
.
Examples:
racecar
hello
A man, a plan, a canal: Panama
outputFormat
Print True
if the processed string is a palindrome; otherwise, print False
.
racecar
True