Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Long Repeat by David_Jones
def long_repeat(line):
if not line:
return 0
max_repeats = repeats = 1
for i in range(len(line) - 1):
if line[i] == line[i+1]:
repeats += 1
else:
max_repeats, repeats = max(repeats, max_repeats), 1
return max(repeats, max_repeats)
May 2, 2019