#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <set>
using namespace std;
bool vis[10];
string ch;
int len;
void dfs(int k, string s)
{
if(k == 0){
cout<<s<<endl;
return;
}
for(int i = 0; i < len; i++){
if(!vis[i]){
vis[i] = true;
dfs(k-1, s+ch[i]);
vis[i] = false;
while(i < len && ch[i] == ch[i+1])
i++;
}
}
}
int main()
{
ios::sync_with_stdio(false);
while(cin>>ch){
memset(vis, 0, sizeof(vis));
len = ch.length();
sort(ch.begin(), ch.end());
string temp;
dfs(len, temp);
}
return 0;
}