传送门UVa 10098 - Generating Fast
一看这标题我就知道能水过。果然。
题意大家肯定都看得懂,不说了。
又是偷懒的做法。。
UVa挂了,不过应该没错。
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main()
{
//freopen("input.txt", "r", stdin);
int n;
cin >> n;
while (n--)
{
string str;
cin >> str;
sort(str.begin(), str.end());
cout << str << endl;
while (next_permutation(str.begin(), str.end()))
cout << str << endl;
cout << endl;
}
return 0;
}