#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
bool cmp(char a,char b)
{
if(a>='A'&&a<='Z'&&b>='A'&&b<='Z')
return a<b;
if(a>='a'&&a<='z'&&b<='z'&&b>='a')
return a<b;
if(a>='a'&&a<='z'&&b>='A'&&b<='Z')
return a<(b+32);
if(a>='A'&&a<='Z'&&b>='a'&&b<='z')
return (a+32)<=b;//体现了A<a这一点;
}
int main()
{
int t;
char s[15];
scanf("%d",&t);
while(t--)
{
scanf("%s",s);
int n=strlen(s);
sort(s,s+n,cmp);
do {printf("%s\n",s);
}while(next_permutation(s,s+n,cmp));

}
return 0;
}

相关文章:

  • 2021-09-11
  • 2021-08-30
  • 2021-10-13
  • 2022-01-26
  • 2022-12-23
  • 2021-12-26
  • 2021-06-24
  • 2021-11-05
猜你喜欢
  • 2022-12-23
  • 2021-12-11
  • 2022-12-23
  • 2022-12-23
  • 2021-05-11
  • 2022-12-23
  • 2022-02-11
相关资源
相似解决方案