class Solution: # @param s, a string # @return a boolean def isPalindrome(self, s): pattern = re.compile('[\W_]+') A=pattern.sub('', s.lower()) if A==A[::-1]: return True else: return False
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment