题目说白了就是给你一段字符串 让你给出它的下一个字典序排列
如果没有的话就输出NO SUCCESS!@!@#什么的
好像是这样,我题目也没怎么看懂,
就是用了next_permutation() 函数
这个是用了求下一个字典序的全排列,int char string 都可以拿来用
#include<algorithm>
#include<string>
#include<cstring>
#include<stdio.h>
#include<iostream>
#include<vector>
using namespace std;
int main(){
string s;
char ch;
while (cin>>s){
if (s == "#")
break;
bool flag=true;
while (next_permutation(s.begin(), s.end())){
flag = false;
cout << s << endl;
break;
}
if (flag)
printf("No Successor\n");
}
return 0;
}