question link is :- https://hack.codingblocks.com/contests/c/537/737
Please tell me where i am wrong in my code
My code is:-
#include<bits/stdc++.h>
using namespace std;
void permutations(char *in,int i){
if(in[i]==’\0’){
cout<<in<<endl;
return;
}
for(int j=i; in[j]!='\0'&&((i==j)||(in[i]!=in[j])) ;j++){
swap(in[i],in[j]);
permutations(in,i+1);
//backtracking
swap(in[i],in[j]);
}
}
int main() {
char in[100];
cin>>in;
//sort(in,in+strlen(in));
permutations(in,0);
return 0;
}