UVA 146 ID Codes
题目大意:给出一个字符串,输出一比这字符串大的最小的下一字符串
解题思路:next_permutation函数的调用
#include <iostream>
#include <string.h>
#include <iostream>
#include <algorithm>
using namespace std;
char str[1000];
int main() {
while(scanf("%s", str) && str[0] != '#') {
if(next_permutation(str, str+strlen(str)))
printf("%s\n", str);
else
printf("No Successor\n");
}
return 0;
}