Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Long Repeat by Rounin
def long_repeat(line):
tmp = (1 if len(line) > 0 else 0)
maxlen = tmp
for i in range(1, len(line)):
tmp = (1 if i != 0 and line[i-1] != line[i] else tmp + 1)
maxlen = max(maxlen, tmp)
return maxlen
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"?')
Aug. 12, 2017