Advertisement
lamiastella

Untitled

May 31st, 2016
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. class Solution:
  2.     # @param A : string
  3.     # @return an integer
  4.  
  5.     def clean_string(self, string):
  6.         result = []
  7.         str_list = string.split()
  8.         for word in str_list:
  9.             result.append(''.join(ch for ch in word if ch.isalnum()))
  10.         return "".join(result).lower()
  11.    
  12.     def isPalindrome(self, A):
  13.         cleaned = clean_string(A)
  14.         print(cleaned)
  15.         if cleaned[::-1]==cleaned:
  16.             return 1
  17.         return 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement