#C13771. Alphanumeric Palindrome Checker
Alphanumeric Palindrome Checker
Alphanumeric Palindrome Checker
Given a string S, determine whether it is a palindrome, considering only alphanumeric characters and ignoring cases. In other words, the string is a palindrome if it reads the same forward and backward after removing all non-alphanumeric characters and converting all letters to the same case.
Mathematically, a string S of length n is a palindrome if for every index \(i\) (where \(0 \le i < n\)), the following holds:
For example, the string "A man, a plan, a canal, Panama" is a palindrome.
inputFormat
The input consists of a single line containing a string S. The string may include spaces, punctuation, and other non-alphanumeric characters.
outputFormat
Output a single line: either True
if the string is a palindrome; otherwise, output False
.
A man, a plan, a canal, Panama
True