Test cases not passing, the same code worked for the smaller case

#include
#include
#include
using namespace std;

void permute(char s[], int index, set &out)
{
if(s[index]==’\0’)
{
out.insert(s);
return;
}
for(int j=index; s[j]!=’\0’; j++)
{
swap(s[index],s[j]);
permute(s, index+1, out);
swap(s[index],s[j]);
}
}

bool compare(char a, char b)
{
return b>a;
}

int main() {
char s[100];
cin>>s;
set out;
permute(s, 0, out);
for (auto rit=out.rbegin(); rit!=out.rend(); ++rit)
{
if(*rit>s){cout<<*rit<<endl;}
}
}

Hello @varun.saxena,

I have corrected your code:

You were iterating the set in the wrong way.

Hope, this would help.
Give a like if you are satisfied.