fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. string s;
  6. cin>>s;
  7. bool val = next_permutation(s.begin(),s.end());
  8. if(val==false)
  9. cout<<"no";
  10. else
  11. cout<<s;
  12. }
Success #stdin #stdout 0.01s 5516KB
stdin
lmno
stdout
lmon