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 dasich12
def longest_palindromic(text):
for i in range(len(text)):
for j in range(i+1):
k = text[j:j+len(text)-i:]
if k==k[::-1]:
return k
if __name__ == '__main__':
assert longest_palindromic("artrartrt") == "rtrartr", "The Longest"
assert longest_palindromic("abacada") == "aba", "The First"
assert longest_palindromic("aaaa") == "aaaa", "The A"
March 2, 2016