#include <iostream>
#include <vector>
#include <string>
using namespace std;
void backtracking(string s, string path, vector<bool>& used) {
if (path.size() == s.size()) {
cout << path << endl;
return;
}
for (int i = 0; i < s.size(); i++) {
if (!used[s[i]-'a']) {
used[s[i]-'a'] = true;
path.push_back(s[i]);
backtracking(s, path, used);
path.pop_back();
used[s[i]-'a'] = false;
}
}
}
int main()
{
vector<bool> used(26, false);
string s;
cin >> s;
backtracking(s, "", used);
return 0;
}