Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Long Repeat by bryon.hance
def long_repeat(line):
"""
length the longest substring that consists of the same char
"""
# your code here
max_count = 0
last_char = ""
for char in line:
if char == last_char:
count += 1
else:
count = 1
last_char = char
if count > max_count:
max_count = count
return max_count
July 28, 2019
Comments: