#C9941. Palindrome Checker
Palindrome Checker
Palindrome Checker
Given a string, determine whether it is a palindrome when ignoring spaces, punctuation, and case differences. Specifically, filter out all whitespace characters and punctuation marks, convert all remaining characters to lowercase, and then compare the resulting string with its reverse. Mathematically, if we let (\text{cleaned}) represent the processed string, the condition for a palindrome is expressed as: $$\text{cleaned} = \text{reverse(cleaned)}$$. For example, the string "A man, a plan, a canal, Panama!" is a palindrome.
inputFormat
The input is provided via standard input (stdin) and consists of a single line string that may include spaces, punctuation, and mixed case letters. Note that the string can be empty.
outputFormat
Output a single line to standard output (stdout): print "YES" if the processed string is a palindrome, and "NO" otherwise.## sample
A man, a plan, a canal, Panama!
YES