Clean Palindrome Check
A phrase may contain spaces, commas, and mixed letter case, but those are just 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 from left to right and right to left; otherwise, return False.
Примеры
Ввод
"A man, a plan, a canal: Panama"Вывод
TrueВвод
"race a car"Вывод
FalseВвод
" "Вывод
TrueНужно реализовать
def is_palindrome(s):
Теги
stringstwo-pointers
Logáil isteach chun stair na n-aighneachtaí a fheiceáil
Logáil isteachLogáil isteach chun an Meantóir IS a úsáid
Logáil isteachVisible tests
1
Input
"A man, a plan, a canal: Panama"Expected
True2
Input
"race a car"Expected
False3
Input
" "Expected
True4
Input
"0P"Expected
False5
Input
"ab_a"Expected
True6
Input
"No lemon, no melon"Expected
TrueFocus radio
Paused · SomaFM · Fluid