Compress the String!

  • + 0 comments
    from itertools import groupby
    S = input()
    ll = [(len(list(g)), int(k))  for k, g in groupby(S)]
    for x in ll:
        print(x, end=" ")