#include <bits/stdc++.h>
using namespace std;
int main() {
  char line[(1 << 20) + 1];
  bool prevAmp = false;
  int lino = 0;
  while (gets(line) != NULL) {
    int i;
    for (i = 0; line[i]; ++i) {
      if (line[i] != ' ') break;
    }
    if (line[i] == '#') {
      if (!prevAmp && lino != 0) putchar('\n');
      printf("%s\n", line);
      prevAmp = true;
    } else {
      for (int j = 0; line[j]; ++j) {
        if (line[j] != ' ') putchar(line[j]);
      }
      prevAmp = false;
    }
    ++lino;
  }
  if (!prevAmp) putchar('\n');
  return 0;
}
