#include <iostream>
#include <vector>
#include <cstring>
using namespace std;
vector<string> store;
void wholesort(string pre,string x){
    if(x.length()==1){
        cout<<pre+x<<endl;
    }
    for(int i=0;i<x.length();i++){
        string nextpre;
        string nextx=x.substr(0,i)+x.substr(i+1);
        nextpre=pre+x[i];
        wholesort(nextpre, nextx);
    }
}
int main() {
    string x;
    while(cin>>x){
        wholesort("", x);

    }
}