How to split a string in the following way:
a = "111554222117"
My goal is to split string into several pieces, where the continuous repeated will grouped together. The output will be a list
b = ['111','55','4','222','11','7']
PS: not tool can be used like itertools since this is an interview question.
My attempt is to use at least two for loop, but it is not effective. how to use only one loop.