A phrase is a palindrome if, after converting uppercase letters to lowercase and removing everything that isn't a letter or a digit, it reads the same forwards and backwards.
Given a string s, return true if it is a palindrome and false otherwise.
Examples
Example 1
- Input
- s = "A man, a plan, a canal: Panama"
- Output
- true
- Why
- After cleanup it reads "amanaplanacanalpanama" both ways.
Example 2
- Input
- s = "race a car"
- Output
- false
Example 3
- Input
- s = " "
- Output
- true
- Why
- After cleanup the string is empty, which counts as a palindrome.
Constraints
1 <= s.length <= 2 * 10^5scontains printable ASCII characters.