TEST CASES SHOWING WRONG.EVEN THOUGH CODE IS WORKING RIGHT

#include
#include
#include
using namespace std;

void permutations(string &in,int i,string &prev)
{
if(i==in.length())
{
if(in>prev)
cout<<in<<endl;
return;
}

for(int j=i;j!=in.length();j++)
{
    swap(in[i],in[j]);
    permutations(in,i+1,prev);
    swap(in[i],in[j]);
}

}

int main()
{
string in;
getline(cin,in);
string prev=in;
permutations(in,0,prev);
}

hi @Mukul-Shane-1247687648773500,

your code does not print in lexicographically larger order
you can use set to store as it keeps in sorted order and then print

here’s the updated code https://ide.codingblocks.com/s/660417

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.

I haven’t studied set.So I have used vector.Its still showing test cases wrong.

hi @Mukul-Shane-1247687648773500,
i can see you have done the question using vectors… is the doubt clear now?