Clean Phrase Palindrome

You can check a palindrome even inside a regular phrase with spaces, punctuation, and mixed letter case. Given a string s, consider only letters and digits, and ignore uppercase versus lowercase. Return True if the cleaned string reads the same forward and backward.

Примеры

Ввод
"A man a plan a canal Panama"
Вывод
True
Ввод
"race a car"
Вывод
False
Ввод
""
Вывод
True

Нужно реализовать

def is_palindrome(s):

Теги

stringstwo-pointers
PostgreSQLv16

Koodin suorituksen tulos näkyy tässä

Visible tests
1
Input
"A man a plan a canal Panama"
ExpectedTrue
2
Input
"race a car"
ExpectedFalse
3
Input
""
ExpectedTrue
4
Input
"Was it a car or a cat I saw?"
ExpectedTrue
5
Input
"0P"
ExpectedFalse
6
Input
"ab_a"
ExpectedTrue
Focus radio
Paused · SomaFM · Fluid