#include <bits/stdc++.h>
using namespace std;
bool Ok(string nap) {
  int i = 0;
  while (i < nap.size() && nap[i] == ' ') ++i;
  if (i < nap.size() && nap[i] == '#') return true;
  return false;
}
int main() {
  ios_base::sync_with_stdio(0);
  vector<string> a;
  string nap;
  while (getline(cin, nap)) a.push_back(nap);
  for (int l = 0; l < a.size();) {
    if (l != 0) cout << endl;
    if (Ok(a[l])) {
      cout << a[l];
      ++l;
    } else {
      int p = l;
      while (p < a.size() && !Ok(a[p])) ++p;
      --p;
      nap = "";
      for (int i = l; i <= p; ++i)
        for (int j = 0; j < a[i].size(); ++j)
          if (a[i][j] != ' ') nap += (char)a[i][j];
      cout << nap;
      l = p + 1;
    }
  }
  cout << endl;
  return 0;
}
