Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Long Non Repeat by Julita_Pogorzelska
def non_repeat(line):
long=tillrepeat(line)
for i in line:
for k in range(len(line)):
if len(long)<=(len(line)//2):
cand=tillrepeat(line[k:])
if len(cand)>len(long):
long=cand
return long
def tillrepeat(line):
longest=""
for i in line:
if not i in longest:
longest+=i
else:
break
return longest
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert non_repeat('aaaaa') == 'a', "First"
assert non_repeat('abdjwawk') == 'abdjw', "Second"
assert non_repeat('abcabcffab') == 'abcf', "Third"
print('"Run" is good. How is "Check"?')
Dec. 28, 2017