Compress the String!

  • + 0 comments
    from itertools import groupby
    result = [f"({len(list(group))}, {char})" for char,group in groupby(input())]
    print (" ".join(result))