Tricky permutations.^&*@

https://ide.codingblocks.com/s/53370
https://hack.codingblocks.com/contests/c/512/737

i m getting repeated answers. how can i remove them?

store them in set. as it will only store the unique permutations.
use set < string > s;
Hit like if u get it

the question says dont use set or map.

use vector and sort them. If any permutation is equal to the previous one then don’t print it.
OR
you can sort the string initially and permutate accordingly

https://ide.codingblocks.com/s/53377

i did , and i m getting right ans but it is showing tle for the last case.