#include <bits/stdc++.h>

using namespace std;

vector<string> A;
string S;
string ans;

int getPos() {
	int pos = 0;
	for (int i = 0; i < 100 && i < (int) ans.size() && pos < (int) S.size(); i++) {
		if (S[pos] == ans[i]) {
			pos++;
		}
	}
	return pos;
}

int main() {
	// assert(freopen("calloc.in", "r", stdin));
	// assert(freopen("calloc.out", "w", stdout));
	cin.sync_with_stdio(false);


	while (cin >> S) {
		A.push_back(S);
	}
	sort(A.begin(), A.end());

	for (int i = 0; i < (int) A.size(); i++) {
		S = A[i];
		int pos = getPos();
		if (pos < (int) S.size()) {
			ans += S.substr(pos);
		}
	}
	cout << ans << endl;

	return 0;
}