You are viewing a single comment's thread. Return to all comments →
Nice solution! One thing that condenses the code a bit is using itertools.groupby to turn the logic of the first loop into a 1 liner:
l = [(ch, len(list(g))) for ch, g in groupby(s)]
Seems like cookies are disabled on this browser, please enable them to open this website
Special String Again
You are viewing a single comment's thread. Return to all comments →
Nice solution! One thing that condenses the code a bit is using itertools.groupby to turn the logic of the first loop into a 1 liner: