Few test cases not working

#include<bits/stdc++.h>
using namespace std;

int compare (const void *a, const void * b)
{ return ( *(char *)a - *(char *)b ); }

bool safe(char in[],int i,int j)
{
for(int n=i;n<j;n++)
{
if(in[n]==in[j])
{
return 0;
}
}
return 1;
}

void per(char in[],int i)
{
if(in[i]==’\0’)
{

    cout<<in<<endl;
    return;
}
for(int j=i;in[j]!='\0';j++)
{
    bool check=safe(in,i,j);
    if(check){
    swap(in[i],in[j]);
    per(in,i+1);
    swap(in[i],in[j]);
}
}

}

int main()
{
char in[100];
cin>>in;
qsort(in, (strlen(in)), sizeof(in[0] ), compare );
per(in,0);
return 0;
}

wait for a while i am debugging your code

Hi,
so the output in not coming in lexographically increasing order that is why u are getting some wrong answers

just in the base condition put the char* value in a vector
in the main after the function call sort the resultant vector
and then o/p the value this would give u success