#include <iostream>
#include <bits/stdc++.h>
using namespace std;

string s;
int book[26];

void dfs(int index){
    if(index==s.size()){
        cout<<s;
        cout<<endl;
        return;
    }
    for(int i=0;i<26;i++){
        if(book[i]==1){
            char c = i+'a';
            s[index]=c;
            book[i]=2;
            dfs(index+1);
            book[i]=1;
        }
    }
    return;
}

int main() {
    cin>>s;
    for(int i=0;i<s.size();i++){
        book[s[i]-'a'] = 1;
    }
    dfs(0);
    return 0;
}