#C8119. Clean Palindrome Checker
Clean Palindrome Checker
Clean Palindrome Checker
Given a string s, determine whether it is a palindrome or not. In this problem, you need to ignore spaces, punctuation, and case differences. A palindrome is a string that reads the same forwards and backwards after removing all non-alphanumeric characters.
For example, the input "A man a plan a canal Panama" should yield True
, and "random string" should yield False
.
You can use the following mathematical expression to represent the condition for a palindrome if sclean is the cleaned string of length n:
\( \text{s_clean}[i] = \text{s_clean}[n-i-1] \quad \forall\, 0 \le i < n \)
inputFormat
The input consists of a single line containing the string s.
The string can contain letters, digits, spaces, and punctuation. Its length can be zero or more.
outputFormat
Output a single line: True
if the processed string is a palindrome, or False
otherwise.
A man a plan a canal Panama
True
</p>