#K59362. Palindrome Checker

    ID: 30848 Type: Default 1000ms 256MiB

Palindrome Checker

Palindrome Checker

Given a string s, determine whether it is a palindrome. In this problem, you must ignore all spaces, punctuation, and letter case. More formally, if you let \( s_{filtered} \) be the string obtained by removing all non-alphanumeric characters from s and converting the remaining characters to lowercase, then you must check whether

[ s_{filtered} = s_{filtered}^{\text{reversed}} ]

If the equality holds, the string is a palindrome and the answer is True; otherwise the answer is False.

Examples:

  • Input: "A man, a plan, a canal, Panama" → Output: True
  • Input: "race a car" → Output: False

inputFormat

The input consists of a single line containing a string s. This string may include spaces, punctuation, and digits.

outputFormat

Output a single line: True if the cleaned version of the string is a palindrome, or False otherwise. The output should not include any extra characters or spaces.

## sample
A man, a plan, a canal, Panama
True