#K52487. Valid Palindrome Checker

    ID: 29320 Type: Default 1000ms 256MiB

Valid Palindrome Checker

Valid Palindrome Checker

Given a string S, determine whether it is a valid palindrome. A valid palindrome is defined as a string that reads the same backward as forward after removing all non-alphanumeric characters and converting all letters to lowercase.

In other words, if we define \( \tilde{S} \) as the string obtained by filtering out non-alphanumeric characters from \( S \) and converting all remaining characters to lowercase, then the string is a palindrome if and only if \( \tilde{S} = \tilde{S}^R \), where \( \tilde{S}^R \) is the reverse of \( \tilde{S} \).

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 the string \( S \). The string can include letters, digits, spaces, and punctuation.

outputFormat

Output a single line containing either "True" if the processed string is a palindrome, or "False" otherwise.

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