#K79867. Valid Palindrome Checker
Valid Palindrome Checker
Valid Palindrome Checker
Given a string s, determine whether it is a valid palindrome. A valid palindrome is defined as a string that reads the same forward and backward after removing all non-alphanumeric characters and converting all letters to the same case. For example, the string A man, a plan, a canal: Panama
is a palindrome because after processing it becomes amanaplanacanalpanama
.
Your task is to implement a program that reads a string from standard input and prints YES
if the string is a valid palindrome, or NO
otherwise.
Note: An empty string and a single-character string are considered palindromes.
inputFormat
The input consists of a single line containing the string s. The string can include spaces, punctuation, and other non-alphanumeric characters.
outputFormat
Output a single line: YES
if the processed string is a palindrome, or NO
otherwise.
A man, a plan, a canal: Panama
YES