#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  string a, b;
  bool ok = 0;
  while (getline(cin, a)) {
    bool isj = 0;
    for (int i = 0; i < a.size(); i++)
      if (a[i] != ' ') {
        if (a[i] == '#') {
          isj = 1;
        }
        break;
      }
    if (isj) {
      if (ok) {
        for (int i = 0; i < b.size(); i++)
          if (b[i] != ' ') cout << b[i];
        cout << endl;
        b = "";
        ok = 0;
      }
      cout << a << endl;
    } else {
      b += a;
      ok = 1;
    }
  }
  if (ok) {
    for (int i = 0; i < b.size(); i++)
      if (b[i] != ' ') cout << b[i];
    cout << endl;
  }
  return 0;
}
