#include <bits/stdc++.h>
using namespace std;
char s[1048600];
int main() {
  int i;
  bool f = 0, g = 0, h = 0;
  while (gets(s) != NULL) {
    f = 0;
    for (i = 0; s[i] != 0; i++) {
      if (s[i] == '#') {
        f = 1;
        break;
      } else if (s[i] != ' ') {
        break;
      }
    }
    if (f) {
      if (g) putchar(10);
      ;
      puts(s);
      g = 0;
      continue;
    }
    g = 1;
    for (; s[i] != 0; i++)
      if (s[i] != ' ') {
        putchar(s[i]);
        h = 1;
      }
  }
  if (!f) putchar(10);
  ;
  return 0;
}
