感触:STL真好用~~~
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
int main()
{
char s[60];
cin>>s;
while(s[0]!='#')
{
int len=strlen(s);
if(next_permutation(s,s+len))
{
cout<<s<<endl;
}
else
{
cout<<"No Successor"<<endl;
}
cin>>s;
}
return 0;
}
“下一个排列”next_permutation()