#K75767. Palindrome Checker with Alphanumeric Filter
Palindrome Checker with Alphanumeric Filter
Palindrome Checker with Alphanumeric Filter
Given a string \(s\), determine whether it is a palindrome. In this problem, only alphanumeric characters are considered, and case is ignored. That is, let \(s'\) be the string obtained by removing all non-alphanumeric characters from \(s\) and converting the remaining characters to lowercase. The condition for \(s\) to be a palindrome is:
\[ s' = \text{reverse}(s') \]
An empty string is considered a valid palindrome.
inputFormat
The input consists of a single line containing a string \(s\). The string may include spaces, punctuation, and a mix of uppercase and lowercase letters.
outputFormat
Output a single line: "YES" if the string is a palindrome after filtering, or "NO" otherwise.
## sampleA man, a plan, a canal, Panama
YES
</p>