Permutations of string

code : https://ide.codingblocks.com/s/221859

for string ABC my output is ABC ACB BAC BCA CBA CAB
but i want in this order ABC ACB BAC BCA CAB CBA
i have to sort them lexographically

@chaman9 hey you can do one thing ,intead of printing store that ans string in vector of strings and after filling this vector ,sort that vector ,you will get the ans.

i am not getting what are you trying to say

@chaman9 hey base case me jha ap print krarhe ho ,wha us string ko ek vector of string me store kra lo ,and atlast sort the array,see this pseudo code:
if(inp[i]==’\0’)
{
v.push_back(inpt);
return;
}
in main()
after calling this function sort this vector;
sort(v.begin(),v.end());
and print vector

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.