Recursion subsequences

Whats wrong in my code?

Hello @sktg99,

The order of strings is opposite:
Example;
abcd
Your Output:
abcd abc abd ab acd ac ad a bcd bc bd b cd c d
16
Expected Output:
d c cd b bd bc bcd a ad ac acd ab abd abc abcd
16

Hope, this would help.
Give a like, if you are satisfied.

see my code is not working when i swapped the two functions, i dont know why is it happening

Hello @sktg99,

This is because you have to consider two cases in the following order:

  1. Do not consider that character
  2. Consider that character

Modification:
Comment the first copy statement as shown below:

// out[j]=inp[i];
Sub(inp,out,i+1,j);
out[j]=inp[i];
Sub(inp,out,i+1,j+1);

Hope, this would help.
Give a like if you are satisfied.