Compress the String!

  • + 27 comments

    Looks pretty clean to me (Python 3)

    from itertools import groupby
    print(*[(len(list(c)), int(k)) for k, c in groupby(input())])