RECURSION-DICTIONARY ORDER(SMALLER)--some test case giving wrong answer

link to ques–https://hack.codingblocks.com/contests/c/457/362

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

void permute(char* in,int i,char* x)
{
if(in[i]==’\0’)
{
if(strcmp(in,x)<0){
cout<<in<<endl;}
return;
}

for(int j=i;in[j]!=’\0’;j++)
{
swap(in[i],in[j]);
permute(in,i+1,x);
swap(in[i],in[j]);
}
}

int main()
{
char in[100],x[100];

cin>>in;
strcpy(x,in);
permute(in,0,x);
return 0;
}

Same problem as you did in Dictionary order Larger . You should maintain the order of output in the same order as it is in dictionary :slight_smile:

https://ide.codingblocks.com/#/s/15796
check this out
and samililar u can done with larger