Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Long Repeat by Vereena
def long_repeat(line):
max_counter = 1
counter = 1
if len(line) == 0:
return 0
for i in range(0, len(line)-1):
if line[i] == line[i+1]:
counter+=1
if counter > max_counter: max_counter = counter
else: counter = 1
return max_counter
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"?')
Dec. 16, 2017