Mapped Strings Prob

Why is the output not being printed https://ide.codingblocks.com/s/55156
I have even tried passing the vector as an argument https://ide.codingblocks.com/s/55160 1

The question is ----
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

Can u mention the problem link, so that I can Debug your code there

https://hack.codingblocks.com/contests/c/537/445 this is the problem link

I think your approach is not correct.
Algorithm:
Using Recursion Find all the combinations of string and store them in vector < string > and then sort the vector and print all the strings

By why is the output not being printed in this code ??
Also how do I find the combinations ? Isn’t my recursive approach doing that already ?

Because
you are doing
cout<<v[ s[index] ];
let say
s=β€œ1”;
it means s[0]=β€˜1’
So, your s[index] will give a character and you are doing v[β€˜1’] where as you have to write v[1] ,
So for getting output
use
cout<<v[s[index]-β€˜0’];
Hit like if u get it :slight_smile:

2 Likes