#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
  bool first_line = true, need_line = false;
  while (!cin.eof()) {
    string s;
    size_t i = 0;
    getline(cin, s);
    while (i < s.size() && s[i] == ' ') ++i;
    if (s[i] == '#') {
      if (!first_line) cout << endl;
      cout << s;
      need_line = true;
    } else {
      if (need_line) cout << endl;
      for (size_t j = 0; j < s.size(); ++j)
        if (s[j] != ' ') cout << s[j];
      need_line = false;
    }
    first_line = false;
  }
  cout << endl;
  return 0;
}
