Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Although straightforwardness beats speed. solution in Clear category for The Longest Palindromic by veky
def longest_palindromic(text):
from itertools import combinations
indices = range(1 + len(text))
substrings = (text[i:j] for i, j in combinations(indices, 2))
pallys = (s for s in substrings if s[::-1] == s)
return max(pallys, key=len, default='')
Oct. 26, 2016