1、早知道有STL这种好东西,以前我写过的好多程序,其实实现起来可以不用那么麻烦的。。。
#include<cstdio>
#include<cstring>#include<algorithm>
using namespace std;
int main()
{
int T;
char s[12];
scanf("%d",&T);
while(T--){
scanf("%s",s);
int len=strlen(s);
sort(s,s+len);
do{
printf("%s\n",s);
}while(next_permutation(s,s+len));
printf("\n");
}
return 0;
}