#include <bits/stdc++.h>
using namespace std;
template <typename T>
T inline SQR(const T &a) {
  return a * a;
}
int main() {
  ios::sync_with_stdio(false);
  string aux;
  bool last = false, printed = false;
  while (getline(cin, aux)) {
    istringstream iss(aux);
    string aux2;
    iss >> aux2;
    if (aux2[0] == '#') {
      if (printed && !last) cout << '\n';
      cout << aux << '\n';
      last = true;
    } else {
      for (int i = 0; i < (int)aux.size(); ++i)
        if (aux[i] != ' ') cout << aux[i];
      last = false;
    }
    printed = true;
  }
  if (!last) cout << endl;
  return 0;
}
