poj1146

简单题

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;
}

posted @ 2011-07-12 09:07  undefined2024  阅读(286)  评论(0)    收藏  举报