Compress the String!

  • + 0 comments
    from itertools import groupby
    s = input()
    group = groupby(s,int)
    
    for key, grp in group:
        print((len(list(grp)),key),end=" ")