Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Easy Solution solution in Clear category for Long Repeat by lonnx
import re # regex is probably the most useful thing for strings
def long_repeat(line):
unique,result = set(line), [] # make a set which will get unique elements and declare an empty list
for i in unique: result.append(len(max(re.findall(f"{i}+", line)))) # go through the set and add the length of the max of the result to result
return max(result) if result else 0 # return the max of the result list unless its empty then return 0
July 19, 2020