#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <map>
using namespace std;

/**
	finished 已经完成的字符串
	left 还没完成的字符串
*/
void pailie(string finished, string left) {
    if (left == "") { //全部都完成了
        cout << finished << endl;
        return;
    }

    string nextf = finished;
    string nextl = left;
  
    for (int i = 0; i < left.size(); i++) { //依次遍历未完成的
        nextf += nextl[i]; //把未完成的加入到已完成的字符串中
        nextl = nextl.erase(i, 1); //删除掉该字符
        pailie(nextf, nextl); //继续递归调用
	  
	   //回溯
        nextl.insert(i, 1, nextf[nextf.size() - 1]); 
        nextf = nextf.substr(0, nextf.size() - 1);

    }
    return;
}

int main() {

    string s;
    getline(cin, s);
    sort(s.begin(), s.end());
    pailie("", s);

}