Not able to solve cases of duplicate characters

I’m not able to handle the case where there are duplicate characters. They are getting printed multiple times in that case. here is my code. https://ide.codingblocks.com/s/200454

I am debugging the code please permit some time

did u try running it against test cases
for i/p
aab
the o/p is

aba
aba
baa
baa
and u are not required to do anything with the duplicate occurance of characters

also u need to print a sorted list
so store them in vector
and sort the vector before printing

can you please explain how to solve it. I’m not able to get the logic which is to be implemented

just use the permutation of string cod e
add to vector is the string so formed is bigger than the original string

at the end sort the vector
print the strings in new line

i have added comments whereever possible