/******************************************************************************
Online Java Compiler.
Code, Compile, Run and Debug java program online.
Write your code in this editor and press “Run” button to execute it.
******************************************************************************/
import java.util.;
public class Main
{
static String s = “”;
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String str = scan.next();
// int[] arr = new int[N];
// for(int i=0;i<N;i++){
// arr[i] = scan.nextInt();
// }
// int T = scan.nextInt();
//int[] arr ={10,1,2,7,6,1,5};
//String str = “ABA”;
char[] cc = new char[str.length()];
for(int i=0;i<str.length();i++){
cc[i] = str.charAt(i);
}
Arrays.sort(cc);
String s = “”;
for(char c : cc){
s = s+c;
}
// System.out.println(s.substring(0));
TrickyPer(s,"");
}
public static void TrickyPer(String que,String res){
if(que.length() == 0){
if(!s.contains(res)){
System.out.println(res);
s=s+res+";";
}
return;
}
for(int i=0;i<que.length();i++){
char c = que.charAt(i);
String str = que.substring(0,i)+que.substring(i+1);
TrickyPer(str,res+c);
}
}
}