PKU 1146 ID Codes
- C++ならnext_permutation()で終り
int main() { string line; while (getline(cin, line) && line != "#") { if (next_permutation(line.begin(), line.end())) { cout << line << endl; } else { cout << "No Successor" << endl; } } }
int main() { string line; while (getline(cin, line) && line != "#") { if (next_permutation(line.begin(), line.end())) { cout << line << endl; } else { cout << "No Successor" << endl; } } }