Given a digit sequence, print the possible decodings of the given digit sequence
A few hints :


compile your code with all warning enabled (calls doesn't seem to be used, does it ?)
write your code in such a way that it can easily be tested. This includes taking a well-defined input and returning a well-defined value (instead of printing it).
write tests.


An example of dynamic programming approach (but I do think it will be better for you if you try to rewrite your solution with tests first, at least you'll be able to compare results and performance): asuming you have a string s "dddddD1D2" (a string composed of any digits then digit D1 then digit D2) and you know the number of combinations for all strings "" (empty string), "d", "dd", "ddd", ..., "ddddddD1", how to you know the number of combinations for string s ? 

You have two different options :


either D2 is to be converted on its own (if D2 is positive). So if D2 is positive, you have as many combinations like this one as you have combinations for "ddddddD1" which is a known value.
either D2 is to be converted with previous digit D1. This is possible if 1 &lt;= 10*D1 + D2 &lt;= 26. If it is the case, you have as many combinations as the number of combinations for "dddddd" which is a known value.


Well, I gave you a solution assuming you had a solution. How do you get such a thing working ? You just need to iterate over the string and for each string position, you keep track of the number of combinations that can be generated using characters up to that point :


0 character : 1 combination
1 character : it has to be converted on its own. Reuse the solution for 0 characters.
2 characters : reuse the solution for 0 and 1 characters
n characters : reuse the solution for n-2 and n-1 characters.


This is a classic example of algorithm where we can define the number of elements with a property without having to enumerate them.

You can either save the two last results as you progress or you can keep track of the result for each index in an array. This is up to you.

Reusing your exemples and adding more :


nb("") = 1
nb("1") = nb("") = 1
nb("12") = nb("1") + nb("") = 1 + 1 = 2
nb("123") = nb("12") + nb("1") = 1 + 2 = 3
nb("1234") = nb("123") = 3 because 34 cannot be converted to a letter.


Disclaimer : I haven't tried any of this but I think it kind of makes sense. You'll see if it works as you write tests and compare with the results from your current code.