public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder out = new StringBuilder();
		String line;
		Queue<Character> q = new LinkedList<>();
		boolean hyphen = false;
		while ((line = in.readLine()) != null) {
			if ((line = line.trim()).equals("#"))
				break;
			char[] l = line.trim().toCharArray();
			for (int i = 0; i < l.length; i++) {
				if (Character.isLetter(l[i]))
					q.add(l[i]);
				else if (l[i] == ' ') {
					while (!q.isEmpty())
						out.append(q.poll());
					if(hyphen)
						out.append('\n');
					hyphen = false;
					out.append(' ');
				}
			}
			if (l[l.length - 1] != '-')
				while (!q.isEmpty())
					out.append(q.poll());
			else
				hyphen = true;
			out.append('\n');
		}
		System.out.print(out);
	}