//全排列的内部实现
include
include
include
using namespace std;
const int maxn = 7;
char site[maxn] = {0};
string str;
void solve(int num)
{
if(num == str.length())
{
for(int i = 0; i < str.length(); ++i)
{
cout << site[i];
}
cout << endl;
}
else
{
int flag = 0; // 判断是否出现过
char tmp;
for(int i = 0; i < str.length(); ++i)
{
// 判断是否出现过
tmp = str[i];
flag = 0;
for(int j = 0; j < num; ++j)
{
if(site[j] == tmp)
{
flag = 1;
break;
}
}
if(flag == 1) continue;
site[num] = str[i];
solve(num+1);
}
}
}
int main()
{
int count = 0; while(cin >> str) { sort(str.begin(), str.end()); // 按字典序输出 solve(0); cout << endl; } return 0;
}