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 Wojtas1411
def rev(t):
k=""
for i in range(len(t)-1, -1, -1):
k+=t[i]
return k
def longest_palindromic(text):
longest=""
for i in range(0,len(text)):
for j in range(i, len(text)+1):
if text[i:j] == rev(text[i:j]) and len(text[i:j]) > len(longest):
longest=text[i:j]
print(longest)
if len(text)-i
Oct. 23, 2016