Recursion-Codes of the string doubt in how to proceed

Recursion-Codes of the string doubt in how to proceed Any hints?

At every position, you have two options. Either to continue with the previous character or treat the current character as a new one.
For eg.
if you have 11. You can either treat is as one one ie AA or as eleven ie K.
So for each location check for these two possibilities. Note 36 can’t be treated as thirty six. So keep a check for that.