#include <bits/stdc++.h>
using namespace std;
string s;
void output(const string& block) {
  string t;
  istringstream in(block);
  while (in >> t) cout << t;
  cout << endl;
}
int main(int argc, char* argv[]) {
  string block;
  string em;
  em += char(1);
  block = em;
  while (getline(cin, s)) {
    istringstream sin(s);
    string t;
    sin >> t;
    if (t.size() && t[0] == '#') {
      if (block != em) output(block);
      block = em;
      cout << s << endl;
    } else {
      if (block == em)
        block = s;
      else
        block += s;
    }
  }
  if (block != em) output(block);
  return 0;
}
