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 veghadam1991
def longest_palindromic(text):
length = len(text)
while True:
num_of_sub = len(text) - length + 1
for i in range(num_of_sub):
sub_text = text[i:i+length]
if sub_text == sub_text[::-1]:
return sub_text
length -= 1
March 20, 2016