#include <bits/stdc++.h>
using namespace std;
string rs(string s) {
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == ' ') s.erase(i, 1);
  }
  return s;
}
int main() {
  char s[1100000];
  vector<string> v;
  while (gets(s)) {
    v.push_back(s);
  }
  vector<bool> mag(v.size(), false);
  for (int i = 0; i < v.size(); i++) {
    for (int j = 0;; j++) {
      if (v[i][j] != '#' && v[i][j] != ' ')
        break;
      else if (v[i][j] == '#') {
        mag[i] = true;
        break;
      }
    }
  }
  int i = 0;
  string con;
  while (i < mag.size()) {
    if (mag[i]) {
      cout << v[i];
      cout << endl;
    } else {
      con = "";
      while (!mag[i] && i < mag.size()) {
        con += v[i];
        i++;
      }
      for (int j = 0; j < con.size(); j++)
        if (con[j] != ' ') cout << con[j];
      cout << endl;
      i--;
    }
    i++;
  }
}
