Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Long Repeat solution in Clear category for Long Repeat by joskar1999
def long_repeat(line):
max = 1
cur_max = 1
if len(line) == 0: return 0
for i in range(len(line)-1):
if line[i+1] == line[i]:
cur_max += 1
if cur_max > max:
max = cur_max
else:
cur_max = 1
return max
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert long_repeat('sdsffffse') == 4, "First"
assert long_repeat('ddvvrwwwrggg') == 3, "Second"
print('"Run" is good. How is "Check"?')
Oct. 21, 2017