#include <bits/stdc++.h>
using namespace std;
char str[10000000];
int main() {
  int fg = 0, p = 0;
  while (gets(str)) {
    fg = 0;
    int len = strlen(str);
    for (int i = 0; i < len; i++) {
      if (str[i] == ' ') continue;
      if (str[i] == '#') {
        fg = 1;
        break;
      } else {
        fg = 0;
        break;
      }
    }
    if (fg) {
      if (p) printf("\n");
      printf("%s\n", str);
      p = 0;
    } else {
      for (int i = 0; i < len; i++) {
        if (str[i] != ' ' && str[i] != '\n' && str[i] != '\0')
          printf("%c", str[i]);
      }
      p = 1;
    }
  }
  if (p) printf("\n");
  return 0;
}
