uva146 ID码

/*极水的题。。。*/

#include"iostream"
#include"stdio.h"
#include"stdlib.h"
#include"algorithm"
#include"string.h"
using namespace std;
char s[1005];
int main()
{
while(scanf("%s",s),s[0]!='#')
{
if(next_permutation(s,s+strlen(s)))
cout<<s<<endl;
else cout<<"No Successor"<<endl;
}
return 0;
}

posted @ 2015-01-24 20:36  Run_For_Love  阅读(126)  评论(0编辑  收藏  举报