#C9542. Check Palindromic Sentence
Check Palindromic Sentence
Check Palindromic Sentence
Given a sentence, determine whether it is a palindrome by considering only its alphanumeric characters and ignoring case. This means you should remove all non-alphanumeric characters and convert the remaining characters to lower-case before checking if the string reads the same backward as forward. Pay attention to the use of standard input (stdin) for receiving input and standard output (stdout) for displaying the result.
In formula terms, if S is the original sentence, let \( F(S) \) be the filtered sequence defined by \( F(S)=\{ s_i: s_i \text{ is alphanumeric, converted to lower-case} \} \). The task is to check if \( F(S)=F(S)^R \), where \( F(S)^R \) denotes the reverse of \( F(S) \).
inputFormat
The input consists of a single line containing the sentence to be checked.
outputFormat
Output a single line containing True
if the sentence is a palindrome after filtering, and False
otherwise. The output is case-sensitive.
A man, a plan, a canal, Panama!
True
</p>