#include <bits/stdc++.h>
using namespace std;
vector<int> inps;
int n, x, y;
bool isFirstSharp(string str) {
  for (int i = 0, _n = (str.size()); i < _n; i++) {
    if (str[i] != ' ') {
      if (str[i] == '#') return true;
      return false;
    }
  }
  return false;
};
string deletePr(string str) {
  string newstr;
  for (int i = 0, _n = (str.size()); i < _n; i++) {
    if (str[i] != ' ') newstr.push_back(str[i]);
  }
  return newstr;
}
int main() {
  string cs;
  string outstring;
  string bstring;
  bool empty(false);
  while (getline(cin, cs)) {
    bool fs = isFirstSharp(cs);
    string newstr = cs;
    if (!fs) newstr = deletePr(cs);
    if (!fs)
      bstring += newstr;
    else if (bstring.size() > 0) {
      cout << bstring << endl;
      ;
      bstring.resize(0);
    }
    if ((newstr.size() == 0) && (bstring.size() == 0)) empty = true;
    if (fs) {
      if (empty) cout << "" << endl;
      cout << cs << endl;
    }
    if (newstr.size() != 0) empty = false;
  }
  if (bstring.size() > 0) cout << bstring << endl;
  ;
  if (empty) cout << "" << endl;
}
