#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false);
  vector<string> lines;
  for (string s; getline(cin, s); lines.emplace_back(s))
    ;
  set<int> special;
  for (int i = 0; i < lines.size(); ++i) {
    int j = 0;
    while (j < lines[i].size() && lines[i][j] == ' ') ++j;
    if (j < lines[i].size() && lines[i][j] == '#') {
      special.emplace(i);
    }
  }
  string ans;
  for (int i = 0; i < lines.size();) {
    if (special.count(i)) {
      ans += lines[i] + "\n";
      if (i + 2 < lines.size() && lines[i + 1].empty() &&
          special.count(i + 2)) {
        ans += "\n";
        ++i;
      }
      ++i;
    } else {
      while (i < lines.size() && !special.count(i)) {
        string t;
        for (int k = 0; k < lines[i].size(); ++k) {
          if (lines[i][k] == ' ') continue;
          t += lines[i][k];
        }
        ans += t;
        ++i;
      }
      ans += "\n";
    }
  }
  cout << ans;
  return 0;
}
