Compress the String!

  • + 0 comments
    from itertools import groupby 
    for N, group in groupby(input()): 
        print((len(list(group)), int(N)), end=' ')