#include <bits/stdc++.h>
using namespace std;
void parsea(string &cad) {
  string re = "";
  for (int i = 0; i < cad.size(); i++)
    if (cad[i] != ' ') re += cad[i];
  cad = re;
}
bool am(string cad) {
  int pos = 0;
  while (pos < cad.size() && cad[pos] == ' ') pos++;
  if (pos >= cad.size()) return false;
  return cad[pos] == '#';
}
int main() {
  string cad;
  vector<string> v;
  while (getline(cin, cad)) v.push_back(cad);
  vector<bool> es(v.size(), false);
  for (int i = 0; i < v.size(); i++)
    if (am(v[i])) es[i] = true;
  vector<string> res;
  string linea = "";
  for (int pos = 0; pos < v.size();) {
    if (!es[pos]) {
      string linea = "";
      while (pos < v.size() && !es[pos]) linea += v[pos], pos++;
      parsea(linea);
      res.push_back(linea);
    } else {
      res.push_back(v[pos]);
      pos++;
    }
  }
  for (int i = 0; i < res.size(); i++) cout << res[i] << endl;
}
