Giving output in Sorted manner

how do i print the permutations in sorted order?

hello @tusharbhardwaj127 i have corrected your code . if you are doing your code by swapping then you can add them to a vector of string and after the function gets over just sort them and then do the comparison.
Find the code below .


I hope i have cleared your doubt .