We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Nice, a list comprehension with an input and print function (bad habbit). I think it's better to add meaningful variable names, at least considering you are showcasing your code for everyone to see.
Here for example, you can add #comments to explain what your doing a different steps.
fromitertoolsimportgroupbysequence=input()groups=[(len(list(c)),int(s))fors,cingroupby(sequence)]print(*groups)# unpack the list of tuple pairs and print.
Cookie support is required to access HackerRank
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 →