#C6723. Valid Palindrome Checker
Valid Palindrome Checker
Valid Palindrome Checker
This problem requires you to determine whether a string is a valid palindrome or not. To check, you must ignore all non-alphanumeric characters and consider only letters and numbers, treating uppercase and lowercase letters as equivalent.
A palindrome is a string that reads the same backward as forward after the non-alphanumeric characters have been removed and the case has been normalized. For example, the string A man, a plan, a canal: Panama becomes a palindrome once processed.
The underlying mathematical idea can be expressed as: $$ \text{Let } s' = \{ c \in s \mid c \text{ is alphanumeric and normalized to lower case} \}. \; \text{Then } s' \text{ is a palindrome if } s' = (s')^R. $$
inputFormat
The input consists of a single string s
(which may include spaces, punctuation, or other symbols) provided through stdin.
outputFormat
Output a single line containing YES
if the string is a valid palindrome after processing, or NO
otherwise. The output should be printed to stdout.
A man, a plan, a canal: Panama
YES