Compress the String!

  • + 0 comments

    from itertools import groupby

    input_value = input()

    group_result = groupby(input_value)

    for key,value in group_result:

    value = sorted(list(value))
    print(f"({int(len(value))}, {int(key)})", end=" ")