#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
char s[1100111];
bool check() {
  int first = 0, l = strlen(s);
  while (first < l && s[first] == ' ') first++;
  return s[first] == '#';
}
int main() {
  bool br = true;
  while (gets(s)) {
    if (check()) {
      if (!br) puts("");
      for (int i = 0, _a = (strlen(s)); i < _a; i++) putchar(s[i]);
      puts("");
      br = true;
    } else {
      br = false;
      for (int i = 0, _a = (strlen(s)); i < _a; i++)
        if (s[i] != ' ') putchar(s[i]);
    }
  }
  if (!br) puts("");
  return 0;
}
