Question
The Oracle's Palindrome Trial
Archaeologists have uncovered an ancient inscription. According to legend, the inscription is a sacred palindrome — it reads the same forwards and backwards. However, over centuries, punctuation marks, spaces, and decorative symbols have been added around the original letters and digits.
Determine whether the inscription is a valid palindrome when only alphanumeric characters are considered, ignoring case.
Input
A single line containing the inscription string.
Output
Print KaTeX can only parse string typed expression if it is a valid palindrome, KaTeX can only parse string typed expression otherwise.
Example
Example 1:
Input
Example 2:
Input
Example 3:
Input
An empty or whitespace-only string has no alphanumeric characters and is trivially a palindrome.
Input
A man, a plan, a canal: PanamaOutputtrueExample 2:
Input
race a carOutputfalseExample 3:
Input
OutputtrueExplanationAn empty or whitespace-only string has no alphanumeric characters and is trivially a palindrome.