I have this code:
from itertools import groupby
text = ["a", "a", "b", "b", "c"]
group = groupby(text)
for k, g in group:
print(k, end= " ")
print(sum(1 for _ in g), end=" ")
Example what I need:
A B C
2 2 1
My itertools only shows like this:
A 2 B 2 C 1