Compress the String!

  • + 0 comments

    import itertools

    if name == 'main': S = input()

    result = [(len(list(group)), int(key)) for key, group in itertools.groupby(S)]    
    
    
    for item in result:
        print(item , end=' ')