Codes of the string

Take as input str, a string. Assume that value of a=1, b=2, c=3, d=4, …. z=26. Write a recursive function (return type Arraylist) to print all possible codes for the string. E.g. for “1123” possible codes are aabc, kbc, alc, aaw, kw.

Input Format
Enter a number

Constraints
None

Output Format
Display all the possible codes

Sample Input
1125
Sample Output
[aabe, aay, ale, kbe, ky]

solution link: https://ide.codingblocks.com/s/288711

how to remove the last comma for the reqd output?

hello @1799sanya
u cannot do it without knowing the count of total strings.
one thing u can do to avoid it is to store all ur valid string in some vector and then print ur vector.