Given a string s, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
Why is the below solution not accepting some of the test cases?
s = "".join(s)
s = s.lower()
if s==s[::-1]:
return "true"
else:
return "false"
Input: s = "A man, a plan, a canal: Panama"
Output: true
This test case is accepted:
Input: s = "race a car"
Output: false
this test case is returning true instead of false