Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- string sol(string s) {
- if(next_permutation(s.begin(),s.end()))
- return s;
- else
- return "no answer";
- }
- int main() {
- int t;
- cin >> t;
- while(t--) {
- string x;
- cin >> x;
- cout << sol(x) << "\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement