def check(word): if word==word[::-1]: return True return False def palindrome(string): left,right=0,len(string) j=right results=[] while left < right-1: temp = string[left:j] j-=1 if check(temp): results.append(temp) if jlen(maxi): maxi=rofl maxlen=len(maxi) ans=0 for rofl in array: if len(rofl)==maxlen: ans+=1 print ans