//土尔逊Torson 编写于2023/06/01
#define _CRT_SECURE_NO_WARNINGS
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

string str;

void swap09601(int x, int y) {
	char temp = str[x];
	str[x] = str[y];
	str[y] = temp;
}

void func09601(int i, int j) {
	if (i == j) {
		for (int m = 0; m < str.size(); ++m) {
			printf("%c", str[m]);
		}
		printf("\n");
	}
	else {
		for (int m = i; m < str.size(); ++m) {
			string s = str;
			swap09601(i, m);
			sort(str.begin() + i + 1, str.end());
			func09601(i + 1, j);
			str = s;
		}
	}
}

int main() {
	int n;
	cin >> str;
	sort(str.begin(), str.end());
	n = str.size();
	func09601(0, n - 1);
	system("pause");
	return EXIT_SUCCESS;
}
// 64 位输出请用 printf("%lld")