You are viewing a single comment's thread. Return to all comments →
from itertools import groupby groups = [] uniquekeys = [] data = input().strip() for k, g in groupby(data): groups.append(len(list(g))) uniquekeys.append(int(k)) print(*list(zip(groups,uniquekeys)))
Seems like cookies are disabled on this browser, please enable them to open this website
Compress the String!
You are viewing a single comment's thread. Return to all comments →