#include <bits/stdc++.h>
using namespace std;
long long i, j, k, l, m, n, s, t, p, q, a, b, aa, bb, d;
char c[2222222];
int main() {
  t = 1;
  while (gets(c) != 0) {
    for (i = 0; c[i] != 0; i++)
      if (c[i] != ' ') break;
    if (c[i] == '#') {
      if (t == 0) puts("");
      puts(c);
      t = 1;
    } else {
      for (i = 0; c[i] != 0; i++)
        if (c[i] != ' ') cout << c[i];
      t = 0;
    }
  }
  if (t == 0) puts("");
}
