import java.io.BufferedReader;
	import java.io.IOException;
	import java.io.InputStreamReader;

	public class Main {

		public static void main(String[] args) {
			try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
				String input;
				while ((input = br.readLine()) != null) {
					System.out.printf("%s\n", condense4(input));
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
		}

		private static String condense4(String input) {
			String[] words = input.split("\\s");
			for (int i = 0; i < words.length - 1; i++) {
				String cur = words[i];
				String next = words[i + 1];
				for (int j = next.length() - 1; j > 0; j--) {
					if (cur.endsWith(next.substring(0, j)))
						return condense4(input.replaceFirst(cur + " " + next,
								new StringBuilder().append(cur).append(next.substring(j, next.length())).toString()));
				}
			}
			return input;
		}
	}