Could you please explain the sample output wrt my code?

how does 26 give us CO

Hi @Sayon-Palit-2873308702757758, i think you have misunderstood the problem
this problem is continuation of smart keypad problem ,if you have’nt done this problem then i will suggest you to do that first,
assuming you did that question let me proceed
in this question what you have to do is to print all of the possible strings from the given array that contains code generated by given number.

Now to compute string from given number you need help from below array

vector<string> table = {" ", ".+@$", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};

for input 34,

it will generate a string of size 2 where the first character will be generated by 3 which will pick any char from table[3] which is “def” and 4 will generate character belonging to string table[4] which is “ghi”
So,
34 will result into combinations :

*dg            *eg         *fg
*dh            *eh         *fh
*di            *ei         *fi

Corresponding strings are output.

  1. as vidhi contains dh
  2. as divyam contains di
  3. as sneha contains eh

So , if you have 26,

here , first character will be generated by table[2]
and second character will be generated by table[6]

so, it will lead to following combinations

*am            *bm         *cm
*an            *bn         *cn
*ao            *bo         *co

In case of any doubt feel free to ask :slight_smile:
Mark your doubt as RESOLVED if you got the answer

yeah I got it.Thanks.