Pls check the code whats wrong
Hey @sneha23
Your final output string needs to be in sorted order
for “acb”
output should be
bac
bca
cab
cba
but urs is
cab
cba
bac
bca
To rectify this use sort
int main()
{
string s;
cin>>s;
string output;
output=s;
sort(s.begin(),s.end()); //sort here :header is <algorithm>
permute(s,output,0);
return 0;
}