Compress the String!

  • + 0 comments
    from itertools import groupby
    if __name__ == "__main__":
        data = input()
        result=[]
        for key, group in groupby(data):
            s=[]
            s.append(len(list(group)))
            s.append(int(key))
            print(tuple(s),end=" ")