Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Long Repeat by zhanggg520
def long_repeat(line):
max_number=1
count=1
if len(line) == 0:
return 0
for i in range(0,(len(line)-1)):
if line[i] == line[i+1]:
max_number+=1
# print(max_number)
if max_number > count:
count=max_number
else:
max_number=1
return count
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"
assert long_repeat('abababaab') == 2, "Third"
assert long_repeat('') == 0, "Empty"
print('"Run" is good. How is "Check"?')
Nov. 9, 2018