None of the test cases passed

#include
#include
using namespace std;

void Permute(string s,int i,string x){

if(s[i]=='\0'){
    if(s>x)
        cout<<s<<endl;
}
else{

    for(int j=i;s[j]!='\0';j++){
        swap(s[i],s[j]);
        Permute(s,i+1,x);
        swap(s[i],s[j]);
    }
}

}

int main() {

string a;
cin>>a;
Permute(a,0,a);

}

In the question it is given that the output must be in sorted order.So instead of printing the output in the base case push the result in a vector. After that sort the vector in the main and then print the vector.

thank u sir all test cases passed earlier none of the test cases passed

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.