Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Long Repeat Inside by flpo
def substrings(string):
l = len(string)
for n in range(l, 1, -1):
for i in range(l - n + 1):
yield string[i:i+n]
def is_repeated(string):
return string in (string * 2)[1:-1]
def repeat_inside(string):
return max(filter(is_repeated, substrings(string)), key=len, default='')
Aug. 17, 2017
Comments: