#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:128000000")
using namespace std;
char s[10000000] = {0};
int main() {
  int t, i, r1, j, v, n, l, m, to, len, p, r, k, x, y, z, fl;
  fl = 0;
  while (cin.getline(s, 10000000)) {
    k = 0;
    n = strlen(s);
    for (i = 0; i < n; i++)
      if (s[i] != ' ') {
        if (s[i] == '#') k = 1;
        break;
      }
    if (k) {
      if (fl) printf("\n");
      printf("%s\n", s);
      fl = 0;
      continue;
    }
    for (i = 0; i < n; i++)
      if (s[i] != ' ') printf("%c", s[i]);
    fl = 1;
  }
  if (fl) printf("\n");
  return 0;
}
