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 vit.aborigen
def is_palindromic(string):
return string == string[::-1]
def longest_palindromic(text):
text_len = len(text)
while text_len:
for i in range(len(text) - text_len + 1):
if is_palindromic(text[i:i + text_len]):
return text[i:i + text_len]
text_len -= 1
Nov. 18, 2018