Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Long Repeat Inside by aleksandr.zaytcev
import re
def repeat_inside(line):
a = [i[0] + i[1] for i in re.findall(r'(?=(.+?)(\1+))', line)]
return max(a, key=len) if a else ''
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"?')
June 1, 2018