#K39697. Palindrome Checker

    ID: 26478 Type: Default 1000ms 256MiB

Palindrome Checker

Palindrome Checker

This problem requires you to determine whether a given string is a palindrome. A string is considered a palindrome if it reads the same forwards and backwards after removing all non-alphabetical characters and disregarding case differences. Specifically, for a string \( S \), after filtering out non-letter characters, it must satisfy \( S = S^R \), where \( S^R \) is the reverse of \( S \).

You will be given multiple input strings via standard input. The input is terminated by a line containing only END. For each input string (excluding the termination line), output YES if it is a palindrome or NO if it is not.

inputFormat

The input is provided via standard input (stdin) as multiple lines, each containing a string. The input terminates with a line that contains only "END". Do not process the line "END".

outputFormat

For each input string (except "END"), output a single line to standard output (stdout) containing "YES" if the string is a palindrome, or "NO" if it is not.## sample

A man, a plan, a canal, Panama!
No lemon, no melon
Hello, World!
END
YES

YES NO

</p>