Compress the String!

  • + 0 comments
    from itertools import groupby
    
    my_string = input()
    
    for my_iterable , my_key in groupby(my_string):
        print(f"({len(list(my_key))}, {my_iterable})", end =" ")