#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(NULL);
  string s;
  string w = "";
  bool wempty = true;
  while (true) {
    getline(cin, s);
    if (cin.eof()) {
      if (!wempty) std::cout << w << std::endl;
      break;
    }
    if (s == "") {
      wempty = false;
      continue;
    }
    bool amplify = false;
    for (char c : s) {
      if (c != ' ' && c != '#') {
        break;
      } else if (c == '#') {
        amplify = true;
        break;
      }
    }
    if (!amplify) {
      for (char c : s) {
        if (c != ' ') w += c;
      }
      wempty = false;
    }
    if (amplify) {
      if (!wempty) std::cout << w << std::endl;
      w = "";
      wempty = true;
      cout << s << endl;
    }
  }
  return 0;
}
