Subsequences recursion

Take as input str, a string. We are concerned with all the possible subsequences of str. E.g.

a. Write a recursive function which returns the count of subsequences for a given string. Print the value returned.

b. Write a recursive function which prints all possible subsequences for a “abcd” has following subsequences “”, “d”, “c”, “cd”, “b”, “bd”, “bc”, “bcd”, “a”, “ad”, “ac”, “acd”, “ab”, “abd”, “abc”, “abcd”.given string (void is the return type for function).
Note: Use cin for input for C++

Input Format
Enter a string

Constraints
None

Output Format
Print all the subsequences in a space separated manner and isplay the total no. of subsequences.

Sample Input
abcd
Sample Output
d c cd b bd bc bcd a ad ac acd ab abd abc abcd
16

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

test cases are not passing

You have to print in the order similar as given in the sample output.
Expected o/p:
d c cd b bd bc bcd a ad ac acd ab abd abc abcd
16

Your o/p:
abcd abc abd ab acd ac ad a bcd bc bd b cd c d
16

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.