Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for The Longest Palindromic by UFO665
# migrated from python 2.7
def longest_palindromic(text):
lst = sorted([text[i:j] for j in range(len(text), -1, -1) for i in range(len(text) + 1) \
if i < j and text[i:j] == text[i:j][::-1]], key=lambda x: len(x), reverse=True)
return min([x for x in lst if len(x) == len(lst[0])], key=lambda x: text.find(x))
March 2, 2016