You are viewing a single comment's thread. Return to all comments →
from itertools import groupby
A = input()
B =groupby(A)
for i, k in B: print((len(list(k)), int(i)), end=" ")
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 →
from itertools import groupby
A = input()
B =groupby(A)
for i, k in B: print((len(list(k)), int(i)), end=" ")