You are viewing a single comment's thread. Return to all comments →
from itertools import groupby
s=input()
for key, group in groupby(s): group_list=list(group) key=int(key) print (tuple((len(group_list),key)),end=" ")
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Compress the String!
You are viewing a single comment's thread. Return to all comments →
from itertools import groupby
s=input()
for key, group in groupby(s): group_list=list(group) key=int(key) print (tuple((len(group_list),key)),end=" ")