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 Chocolater
def repeat_inside(line):
map = (line[i:-k] for i in range(len(line)) for k in range(len(line))
if line[i:-k] != '')
return max([i * x for i in map for x in range(2, len(line) + 1)
if i * x in line] + [''], key=len)
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert repeat_inside('aaaaa') == 'aaaaa', "First"
assert repeat_inside('aabbff') == 'aa', "Second"
assert repeat_inside('aababcc') == 'abab', "Third"
assert repeat_inside('abc') == '', "Forth"
assert repeat_inside('abcabcabab') == 'abcabc', "Fifth"
print('"Run" is good. How is "Check"?')
Aug. 21, 2017