#C12872. Valid Palindrome Check
Valid Palindrome Check
Valid Palindrome Check
Given a string s
, determine whether it is a palindrome. To solve the problem, first convert all uppercase letters in the string to lowercase and remove all non-alphanumeric characters. A palindrome is a string that reads the same forward and backward after these conversions.
Formally, if we define \(filtered(s) = \text{toLowerCase}(\text{removeNonAlnum}(s))\), then s is a palindrome if \(filtered(s) = reverse(filtered(s))\).
inputFormat
The input consists of a single line containing the string s
. The string can include spaces, punctuation, and digits.
outputFormat
Output True
if the processed string is a palindrome, and False
otherwise.
A man, a plan, a canal: Panama
True