Compress the String!

  • + 0 comments
    import itertools
    
    print(" ".join(f"({len(list(g))}, {k})" for k, g in itertools.groupby(input())))