Compress the String!

  • + 0 comments

    from itertools import groupby

    s = input()

    for k, g in groupby(s): print((list(g).count(k),int(k)), end = " ")