#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
// #include <set>
using namespace std;
void uniquePermutations(string str, int i, vector<string> &s){
if (i == str.length()){
auto it = find(s.begin(), s.end(), str);
if (it == s.end()){
//element is already present in the vector
s.push_back(str);
// sort(s.begin(), s.end());
// cout << str << endl;
}
return;
}
for (int j = 0; j < str.length(); j++){
swap(str[i], str[j]);
uniquePermutations(str, i + 1, s);
swap(str[i], str[j]);
}
return;
}
int main(){
string str;
cin >> str;
vector<string> s;
uniquePermutations(str, 0, s);
sort(s.begin(), s.end());
for (auto str : s){
cout << str << endl;
}
}