#include <bits/stdc++.h>
using namespace std;
char s[1200000];
char data[2200000];
int main() {
  int leng = 0;
  bool ff = 0;
  while (gets(s)) {
    int i;
    int n = strlen(s);
    for (i = 0; i < n; i++)
      if (s[i] != ' ') break;
    if (n != 0 && s[i] == '#') {
      data[leng] = 0;
      if (leng || ff) printf("%s\n", data);
      leng = 0;
      printf("%s\n", s);
      ff = 0;
      continue;
    }
    ff = 1;
    for (i = 0; i < n; i++)
      if (s[i] > 32 && s[i] <= 127) data[leng++] = s[i];
  }
  data[leng] = 0;
  if (leng) printf("%s", data);
  if (ff) printf("\n");
}
