Recursion Dictionary Order Smaller

I have solved the question and i am getting same output for sample case but it is failing all test cases. But code is working for all test cases on my laptop.

please send ur code in cb ide

#include
#include<string.h>
#include
using namespace std;

void permute(char *a,char *user,int i)
{
//base case
if(a[i]==’\0’)
{
if(strcmp(a,user)<0)
{
cout<<a<<endl;
return;
}
}

//recursive case
for(int j=i;a[j]!='\0';j++)
{
    swap(a[i],a[j]);
    permute(a,user,i+1);
    swap(a[i],a[j]);
}

}

int main()
{
char a[26];
char user[26];
cin>>a;
int i=0;
while(a[i]!=’\0’)
{
i++;
}
strncpy(user, a, i+1);
sort(a,a+i);
permute(a,user,0);
return 0;
}

please store the result in a vector
sort the vector before printing the elements

since the answer needs to be in lexographic increasing order

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.