Tricky Permutations (Getting WA for some test case)

Can please someone look after my code, what I’m doing wrong. I decided to skip the swap if(j!=i && in[i]==in[j]) but this approach is giving me wrong answer on some test cases.
if(j!=i && in[i]==in[j])

store permutations , sort them and finally print if s[0] and loop from 1 to n and print s[i] if (s[i]!+s[i-1])

I have already thought of this, but I was looking for some way to modify my recursion call so that it works for repetitive characters.
If there is any way to solve this without storing them?

Bro there is a function next_permutation(). It will make this question a piece of cake.

BTW, nice idea.
But the ques says you have to solve it without using any STL.

Well it says without using MAP or SET.

use next permutation , it is the best fit