Recursion mapped strings

I’m not able to understand this question, please explain :
MAPPED STRINGS
We are given a hashmap which maps all the letters with number. Given 1 is mapped with A, 2 is mapped with B……26 is mapped with Z. Given a number, you have to print all the possible strings.

Input Format:
A single line contains a number.

Constraints:
Number is less than 10^6

Output Format
Print all the possible strings in sorted order in different lines.

Sample Input
123
Sample Output
ABC
AW
LC

@poorva2145
We have mapped each english alphabet with its corresponding number in the alphabet.
A -> 1
B -> 2
C -> 3
.
.
X -> 24
Y -> 25
Z -> 26

We are given a number as input. In the given sample testcase , we are given 123.
Now we can read this number in several ways.
We can read it as
1 , 2 , 3
We map each number with its corresponding character from the mapping . 1 gives A , 2 gives B , 3 gives C
Hence the configuration corresponding to 123 is ABC.
123 can also be broken as
12 , 3
which corresponds to LC
( 12 -> L , 3 -> C )
Similarly there is also another configuration ,
1 , 23
which gives AW
( 1 -> A , 23 -> W )

Note that it can also be read as 123 but we have no character corresponding to that number so we just leave it .
Hence the final output is
ABC
AW
LC

1 Like

Thank you.
Now I understand the question.

Please check the code, two test cases are not running.

@poorva2145
Try these -

Input :
23

Expected Output :
BC
W

Your Output :
BC
W#
BC


Input :
4423

Expected Output :
DDBC
DDW

Your Output :
DDBC

1 Like

Thank you.
I solved the question.