#include <bits/stdc++.h>
#define MAX 7
using namespace std;

vector<string> res;
void fun(char s[],string list){
	if(list.size() == strlen(s)){
		cout<<list<<endl;
		return ;
	}
	for(int i = 0; i < strlen(s); i++){
		if(list.find(s[i]) == string::npos)	//list中未加入此字符 
			fun(s,list+s[i]);
	}
		
}


int main(){
	char s[MAX];
	cin>>s;
	int len = strlen(s);
	string list;

	fun(s,list);

}