Can someone please help me with this problem. Thanks in advance.

# help needed in hackerrank problem

**pk301**#2

try to do it backwards. First convert the string into the encrypted code. Then just start from last and at every step you have two choices either to take the current digit only or (if possible i.e. <=26) then take the current and previous digit and corresponding merge it with appropraite position.

We maintain a vector of string for each index which denotes ‘What is the different string we can get if we start from current position’. So, let’s suppose you are building the answer for position ‘i’ (means you have the answers for all the indexes ‘j’ : (i < j <= n-1)). So, at current place you have two choices i.e. either take current position digit only and form a string with the remaining digits (i.e. from [i+1, n-1]) (for doing that we have to just merge the current character with the vector of index ‘j+1’). Or we can take next digit also and check it’s possibility (i.e. <= 26) and at that time we have to just merge that character with the list of strings of index ‘j+2’.

And we have to just print the list of index ‘0’. And we are done! Don’t forget to sort it before printing!