简单题
View Code
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;
char st[100];
int main()
{
//freopen("t.txt", "r", stdin);
while (scanf("%s", st))
{
if (strcmp(st, "#") == 0)
break;
if (next_permutation(st, st + strlen(st)))
printf("%s\n", st);
else
printf("No Successor\n");
}
return 0;
}