Advertisement
sajid161

4:6

Dec 31st, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.  
  6.     int t;
  7.     cin>>t;
  8.     while(t--)
  9.     {
  10.         string s;
  11.         cin>>s;
  12.         if(next_permutation(s.begin(),s.end())) cout<<s<<endl;
  13.         else cout<<"no answer\n";
  14.     }
  15. }
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement