2 test cases showing wrong out of 8 test cases

#include
#include
#include
#include
using namespace std;

vector v;

void permutations(string &in,int i)
{
if(i==in.length()-1)
{
v.push_back(in);
}

for(int j=i;j!=in.length();j++)
{
    swap(in[i],in[j]);            
    permutations(in,i+1);
    swap(in[i],in[j]);
}

}

int main()
{
string in;
getline(cin,in);
permutations(in,0);
sort(v.begin(),v.end());
for(int i=0;i<v.size();i++)
{
if(v[i]==v[i+1])
v.erase(v.begin()+i);
}
for(int i=0;i<v.size();i++)
cout<<v[i]<<endl;
}

hi @Mukul-Shane-1247687648773500,
use a set instead of vector it stores in sorted manner and 1 occurance
Suggestion :- use the data structure according to the need

here’s the updated code https://ide.codingblocks.com/s/660788

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.