Clean Palindrome Check

Real phrases often contain spaces, punctuation, and mixed letter case, but those can be noise when checking a palindrome. Given a string s, consider only letters and digits. Ignore case, so A and a count as the same character. Return True if the cleaned string reads the same forward and backward; otherwise, return False.

Примеры

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

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

def is_palindrome(s: str) -> bool:

Теги

stringstwo-pointers
PostgreSQLv16

Čia bus kodo vykdymo rezultatas

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