Compress the String!

  • + 0 comments
    from itertools import groupby
    
    if __name__ == "__main__":
        s = input()
        print(" ".join(f"({len(list(group))}, {key})" for key, group in groupby(s)))