Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Double Substring solution in Clear category for Double Substring by svisho1983
def double_substring(line):
s=[]
result=[0]
for i in range (1, int(len(line)/2)+1):
s.append(line[:i])
for i in range ((-int(len(s)/2)-1), 0):
s.append(line[i:])
for elem in s:
if line.count(elem)>1:
result.append(len(elem))
return max(result)
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"?')
May 17, 2020