public class Solution {
public static void main(String[] args) {
String str = "";
Scanner sc = new Scanner(System.in);
str = sc.nextLine();
printAll(str.toCharArray(),0);
}
public static void printAll(char[] str,int i){
if (i>=str.length)
return;
if (i == str.length-1)
System.out.println(String.valueOf(str));
else
for (int j = i;j<str.length;j++){
char temp = str[j];
str[j] = str[i];
str[i] = temp;
printAll(str,i+1);
temp = str[j];
str[j] = str[i];
str[i] = temp;
}
}
}