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 mdroz
def non_repeat(line):
string = ""
string2 = ""
i=0
while i < len(line):
if string.count(line[i]) == 0:
string += line[i]
i+=1
else:
if len(string) > len(string2):
string2 = string
i=1 + i - len(string)
string = ""
if len(string) > len(string2):
return string
else:
return string2
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('abcabcfabcabc') == 'abcf', "Third"
print('"Run" is good. How is "Check"?')
Oct. 30, 2017