#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
using namespace std;

int main()
{
	string input;
	getline(cin, input);
	cout << "Vorher: "	<< input << '\n';
	
	vector<string> words;
	stringstream wordparser(input);
	for(string word; wordparser >> word; )
		words.push_back(word);
	sort(words.begin(), words.end());
	
	stringstream outputstream;
	for(const string& word: words)
		outputstream << word << ' ';
		
	string result = outputstream.str();
	cout <<"Nachher: " << result << '\n';
}