You are perfectly right!
I just updated the gist with the fix (I forgot to make solve() recursive, that's the key!).
Your recursive solution is coded beautifully and easy to understand, thanks a lot!
Btw, base on your idea then I found out a solution (edit a little bit):
We need to store the index of the first appearance of decreasing character, for example:
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.