group = groupby([1, 2, 2, 2, 2, 1, 1, 1, 2, 2, 1, 1])
print(max(group, key=lambda k: len(list(k[1]))))
group = groupby([1, 2, 2, 2, 2, 1, 1, 1, 2, 2, 1, 1, 3, 3, 3, 3, 3])
print(max(group, key=lambda k: len(list(k[1]))))
How do you calculate the greatest number of repetitions in a list?