You are viewing a single comment's thread. Return to all 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 =" ")
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 →