#K94907. Valid Palindrome Checker
Valid Palindrome Checker
Valid Palindrome Checker
Given a string s
, determine whether it is a palindrome by considering only alphanumeric characters and ignoring cases. In other words, after removing all non-alphanumeric characters and converting all letters to the same case, the string should read the same forwards and backwards.
A string s is a valid palindrome if it satisfies:
\( s = s_{\text{rev}} \)
where \( s_{\text{rev}} \) denotes the reversed string after filtering out non-alphanumeric characters. Note that an empty string is considered a valid palindrome.
inputFormat
The input consists of a single line containing a string s
. The string may contain spaces, punctuation, or other non-alphanumeric characters.
outputFormat
Output True
if the filtered string is a palindrome; otherwise, output False
.
A man, a plan, a canal: Panama
True