// UVa 10098 - Generating Fast
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
int t;
for (cin >> t; t; t--) {
string s;
cin >> s;
sort(s.begin(), s.end());
cout << s << endl;
while (next_permutation(s.begin(), s.end()))
cout << s << endl;
if (t > 0)
cout << endl;
}
return 0;
}
No comments:
Post a Comment