#C12438. Valid Palindrome
Valid Palindrome
Valid Palindrome
Given a string s, determine whether it is a palindrome considering only alphanumeric characters and ignoring cases.
A palindrome is a sequence that reads the same backward as forward. In this problem, all non-alphanumeric characters should be removed, and the comparison should be case-insensitive. Formally, if the processed string is \( S \), you need to check whether \( S = S^R \), where \( S^R \) denotes the reverse of \( S \).
For example, the string A man, a plan, a canal: Panama
becomes amanaplanacanalpanama
, which is a palindrome.
inputFormat
The input consists of a single string s provided via standard input (stdin). The string may contain spaces, punctuation, and special characters.
outputFormat
Output a single line to standard output (stdout) containing either True
or False
, indicating whether the input string is a valid palindrome under the given conditions.
A man, a plan, a canal: Panama
True