You are viewing a single comment's thread. Return to all comments →
from itertools import groupby S = input() ll = [(len(list(g)), int(k)) for k, g in groupby(S)] for x in ll: print(x, end=" ")
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
Compress the String!
You are viewing a single comment's thread. Return to all comments →