/*
Time:2019.11.7
Author: Goven
type:全排列 (STL)
err:
ref:
知识点:bool next_permutation(start_pos, end_pos, cmp(可自定义))---同sort
*/
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
bool cmp (char a, char b) {
if (a + 32 == b || a - 32 == b) return a < b;
return tolower(a) < tolower(b);
}
int main()
{
int n;
string str;
cin >> n;
while (n--) {
cin >> str;
sort(str.begin(), str.end(), cmp);
cout << str << endl;
while (next_permutation(str.begin(), str.end(), cmp)) {//err1:需要重新定义cmp函数
cout << str << endl;
}
}
return 0;
}
网友评论