Mapped Strings Doubt

Can somebody give me the approach to solve the problem.

in mapped strings problem, it is given that there is a map which stores numbers from 1 to 26 which are correspondingly mapped from A to Z.
1 -> A
2 -> B
3 -> C
.
.
25 -> Y
26 -> Z

Now you have to print all the possible strings which we can form from given input number.
For eg.
input : 123
Now, the different ways in which we can divide string 123 are:
1-2-3 => A-B-C
1-23 => A-W
12-3 => L-C
the hint is that in the recursive call n/10 or something similar to this will be passed.

I am unable to solve the problem.Do i need to use Backtracking here?Or do I need to use Dynamic Programming?

1 Like

there is no need of dynamic programming
recursion will do the work
you can refer this for your reference

2 Likes

How it is printing AW i dry run it but not able to get it for input 123 .
can you please explain how we get AW?

separating “1” and “23” correspond to AW

how it seperating 1 and 23 not getting

Can you dry run for AW