For dictionary question im getting runtime error....please check the code and tell what is wrong

#include <bits/stdc++.h>
using namespace std;
void phoneKeypad(string s,string input)
{ if(input.compare(s)==0)
{return;
}
cout<<input<<endl;
next_permutation(input.begin(),input.end());
return phoneKeypad(s,input);

}
int main()
{
string input;
cin >> input;
string s=input;

sort(s.begin(),s.end());
next_permutation(input.begin(),input.end());
phoneKeypad(s,input);
return 0;
}

please share code in cb ide

#include <bits/stdc++.h> using namespace std; void phoneKeypad(string s,string input) { if(input.compare(s)==0) {return; } cout<<input<<endl; next_permutation(input.begin(),input.end()); return phoneKeypad(s,input); } int main() { string input; cin >> input; string s=input; sort(s.begin(),s.end()); next_permutation(input.begin(),input.end()); phoneKeypad(s,input); return 0; }

i have given the code please check it and provide the solution

bro paste code in


save the code
and then provide link

@imambujsingh08


ur code
but this gives a tle for 1 case

for a correct code refer this