I have a string like:
s = 'aaabcdedddd'In this example, I would want to split the string into something like this.
s = ['aa', 'a', 'b', 'c', 'd', 'e', 'dd', 'dd']Notice how the three-letter repeat of 'aaa' is not kept together, but rather considered a double repeat + a single letter ('aa'+'a'. The 'dddd' at the end is considered double repeat + double repeat ('dd'+'dd').
Is there any way to do this efficiently?