Unable to match the target string exactly (do we need to?)

#include
#include
#include
using namespace std;

void print_string(string s, string print, set &out)
{
out.insert(print);
if(s.length()==0){return;}
//include 1st element
print_string(s.substr(1, s.length()), print+s.substr(0,1), out);
//exclude 1st element
print_string(s.substr(1, s.length()), print+"", out);
}

int main() {
set out;
string s;
cin>>s;
print_string(s, “”, out);
cout<<out.size()<<endl;
for(auto x: out)
{
cout<<x<<", ";
}
return 0;
}

@varun.saxena yeah actually you have to print them in the order as you are finding them, for this you should use a vector of strings and print this vector in reverse order.
if you get any problem look at this code i have updated it in your code https://ide.codingblocks.com/s/240040