#include <bits/stdc++.h>
using namespace std;
int main() {
  int q, w, e, r, t = 0;
  char a[2000000];
  while (gets(a)) {
    for (w = 0; a[w] == ' '; w++)
      ;
    if (a[w] == '#') {
      if (t) {
        t = 0;
        printf("\n");
      }
      printf("%s\n", a);
      continue;
    }
    t = 1;
    for (; a[w]; w++)
      if (a[w] != ' ') printf("%c", a[w]);
  }
  if (t) printf("\n");
  return 0;
}
