why my code is failing all the test cases …answer is correct
include
include
using namespace std;
void dict(string str,int i,string out){
//base case
if(str[i]==’\0’){
if(str>out){
cout<<str<<endl;
}
return;
}
//recurseive case
for(int j = i;str[j]!='\0';j++){
swap(str[i],str[j]);
dict(str,i+1,out);
}
}
int main(){
string str;
cin>>str;
string out = str;
dict(str,0,out);
return 0;
}