
In a Meta developer tooling surface such as Phabricator, text normalization often matters before validation. Write a function that returns True if a string is a palindrome after ignoring all non-alphanumeric characters and treating uppercase and lowercase letters as equal; otherwise return False.
sa-z, A-Z, 0-9).Example 1
s = "A man, a plan, a canal: Panama"True"amanaplanacanalpanama", which reads the same forward and backward.Example 2
s = "race a car"False"raceacar", which is not a palindrome.0 <= len(s) <= 2 * 10^5s may contain letters, digits, spaces, punctuation, and symbolss = "A man, a plan, a canal: Panama"OutputTrueWhyIgnoring spaces, commas, and the colon gives a case-insensitive palindrome.s = "race a car"OutputFalseWhyAfter removing the space, the remaining characters do not mirror exactly.s = ".,"OutputTrueWhyThere are no alphanumeric characters, so the normalized string is empty and is considered a palindrome.0 <= len(s) <= 2 * 10^5s consists of ASCII letters, digits, spaces, punctuation, and symbolsOnly alphanumeric characters participate in comparisonsCharacter comparison is case-insensitivedef is_palindrome(s):