import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author hheng
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {
	public void solve(int testNumber, Scanner in, PrintWriter out) {
        boolean other = false;
        while (in.hasNext()) {
            String s = in.nextLine();
            if (s.trim().startsWith("#")) {
                if (other) { out.println(); other = false; }
                out.println(s);
            }
            else {
                out.print(s.replaceAll(" ", ""));
                other = true;
            }
        }
	}
}
