Can you please help me , how can i use lexicographical order in recursion dictionary -smaller

what logic should i use for output

Hey @lukharshiv The approach is very similar to that of print permutations. After generating all of the permutations and store in list and sort the list .you need to do is compare your ans with the original String and print only when the ans is smaller than the original String.