Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Double Substring by liw_80
def double_substring(line):
length = 0
line_len = len(line)
x = 0
while x < line_len:
sub = line[x]
while line.count(sub) > 1:
if length < len(sub):
length = len(sub)
x = x + 1
if x >= line_len:
break
sub += line[x]
x += 1
return length
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert double_substring('aaaa') == 2, "First"
assert double_substring('abc') == 0, "Second"
assert double_substring('aghtfghkofgh') == 3, "Third"
print('"Run" is good. How is "Check"?')
Feb. 12, 2019