#K81417. Valid Palindrome Check
Valid Palindrome Check
Valid Palindrome Check
This problem requires you to determine whether a given string is a valid palindrome. A string is considered a palindrome if, after converting all uppercase letters to lowercase and removing all non-alphanumeric characters, it reads the same forward and backward.
Note: The check should only consider letters and digits, and should ignore any spaces or punctuation. For example, the string "A man, a plan, a canal: Panama" is a palindrome.
The mathematical formulation of the check can be represented as:
\( \text{filtered}(s) = s' \quad \text{and} \quad s' = reverse(s') \)
where \( s' \) is the string obtained by retaining only the lowercase alphanumeric characters of the original input \( s \).
inputFormat
The input is provided via stdin as a single line containing a string s.
Input format:
s
outputFormat
Output a single line to stdout which is either True
if the provided string is a palindrome, or False
otherwise.
Output format:
result## sample
A man, a plan, a canal: Panama
True