#include <bits/stdc++.h>
using namespace std;
char a[1234567], b[1234567];
int m, n;
int main() {
  while (gets(a)) {
    int f = 0;
    for (int i = 0; a[i]; i++) {
      if (a[i] == ' ') continue;
      if (a[i] == '#') f = 1;
      break;
    }
    if (!f) {
      for (int i = 0; a[i]; i++)
        if (a[i] ^ ' ') b[m++] = a[i];
      b[m] = 0;
      n = 1;
    } else {
      if (n) puts(b);
      puts(a);
      m = 0;
      n = 0;
    }
  }
  if (n) puts(b);
  return 0;
}
