Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for The Longest Palindromic by jeandupont
def longest_palindromic(text):
length = 0
longest = text
for i in range(len(text)-1):
for j in range(i+1,len(text)+1):
t = text[i:j]
if t == t[::-1] and len(t) > length:
longest = t
length = len(t)
return longest
March 8, 2016