Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define op ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
- int main(){
- op;
- int t;
- cin>>t;
- while(t--){
- string s;
- cin>>s;
- bool f=next_permutation(s.begin(),s.end());
- if(f) cout<<s<<endl;
- else cout<<"no answer"<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement