- #include <iostream>
- #include <cstdio>
- #include <string>
- #include <cstring>
- #include <algorithm>
- using namespace std;
- int main(){
- string code;
- while(cin >> code){
- if(code == "#")break;
- if(next_permutation(code.begin(), code.end()))cout << code << endl;
- else cout << "No Successor" << endl;
- }
- return 0;
- }
No comments:
Post a Comment