#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
string s;
bool dirty;
bool amp() {
  for (char c : s) {
    if (c != ' ') return c == '#';
  }
  return false;
}
void flush() {
  if (dirty) cout << '\n', dirty = false;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout << fixed;
  while (getline(cin, s)) {
    if (amp()) {
      flush();
      cout << s << '\n';
    } else {
      for (char c : s) {
        if (c != ' ') cout << c;
      }
      dirty = true;
    }
  }
  flush();
  return 0;
}
