Sunday, September 28, 2014

UVa - 146 - ID Codes


  1. #include <iostream>
  2. #include <cstdio>
  3. #include <string>
  4. #include <cstring>
  5. #include <algorithm>
  6. using namespace std;
  7.  
  8. int main(){
  9.     string code;
  10.     while(cin >> code){
  11.         if(code == "#")break;
  12.         if(next_permutation(code.begin(), code.end()))cout << code << endl;
  13.         else cout << "No Successor" << endl;
  14.     }
  15.     return 0;
  16. }

No comments:

Post a Comment