#K94527. Palindrome Checker

    ID: 38661 Type: Default 1000ms 256MiB

Palindrome Checker

Palindrome Checker

Given a string s, determine whether it is a palindrome by considering only alphanumeric characters and ignoring cases. Formally, a string is a palindrome if it reads the same forward and backward after removing all characters except letters and digits.

For example, the string A man, a plan, a canal, Panama is considered a palindrome.

The mathematical condition can be expressed as: $$\text{filtered}(s) = \text{reverse}(\text{filtered}(s))$$, where \(\text{filtered}(s)\) is the string obtained after removing non-alphanumeric characters and converting all letters to lowercase.

inputFormat

The input consists of a single line containing a string s. The string may include spaces, punctuation, and mixed case letters.

outputFormat

Output a single line: "YES" if the processed string is a palindrome, or "NO" otherwise.## sample

A man, a plan, a canal, Panama
YES

</p>