Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Speedy category for Double Substring by bravebug
def double_substring(line):
for m in range(int(len(line)/2), 0, -1):
for k in range(0, len(line) - m):
search_string = line[k:k + m]
if line.count(search_string) >= 2:
return len(search_string)
return 0
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. 23, 2020
Comments: