
#include <iostream>
#include <list>
#include <map>
#include <sstream>
#include <string>
using namespace std;

int
main2()
{

	map<string, int> letters;

	/*for (string input; getline(cin, input);)
	        for (size_t i = 0; i + 2 < input.length(); ++i)
	        letters[input.substr(i, 3)]++;*/

	for (string input; getline(cin, input);) {
		stringstream s(input);
		string word;
		while (s >> word)
			letters[word]++;
	}

	for (auto& i : letters) {
		cout << i.first;
		for (int j = 0; j < i.second; j++)
			cout << '*';
		cout << endl;
	}

	return 0;
}

template<typename T>
list<T>
merge(list<T>&& a, list<T>&& b)
{
	list<T> c;

	while (!a.empty() && !b.empty()) {
		if (a.front() < b.front()) {
			c.push_back(move(a.front()));
			a.pop_front();
		} else {
			c.push_back(move(b.front()));
			b.pop_front();
		}
	}

	while (!a.empty()) {
		c.push_back(move(a.front()));
		a.pop_front();
	}
	while (!b.empty()) {
		c.push_back(move(b.front()));
		b.pop_front();
	}

	return c;
}

template<typename T>
list<T>
mergesort(const list<T>& l)
{
	if (l.size() <= 1) {
		return l;
	}
	list<list<T>> a;
	for (auto i : l) {
		list<T> temp;
		temp.push_back(i);
		a.push_back(temp);
	}
	for (;;) {
		list<T> x = a.front();
		a.pop_front();
		list<T> y = a.front();
		a.pop_front();
		if (a.empty())
			return merge(move(x), move(y));
		a.push_back(merge(move(x), move(y)));
	}
}
int
main()
{

	list<string> l;
	for (string input; getline(cin, input);)
		l.push_back(input);
	l = mergesort(l);
	for (auto i : l)
		cout << i << endl;
}
