#include <bits/stdc++.h>
using namespace std;
void Fastio() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  string a, tmp = "";
  bool done = 1;
  vector<string> v;
  while (getline(cin, a)) {
    bool st = 0;
    for (int i = 0; i < a.size(); i++) {
      if (a[i] != ' ') {
        if (a[i] == '#')
          st = 1;
        else
          done = 0;
        break;
      }
    }
    if (st) {
      if (!done) cout << tmp << '\n';
      tmp = "";
      cout << a << '\n';
      done = 1;
    } else {
      for (int i = 0; i < a.size(); i++) {
        if (a[i] != ' ') tmp += a[i];
      }
      done = 0;
    }
  }
  if (!done) cout << tmp << '\n';
  return 0;
}
