#include <bits/stdc++.h>
using namespace std;
bool isAmplifying(const string &s) {
  for (int i = 0; i < (int)(s.length()); i++) {
    if (s[i] == ' ') continue;
    if (s[i] == '#') return true;
    return false;
  }
  return false;
}
void removeSpace(string &s) {
  int pos = 0;
  for (int i = 0; i < (int)(s.length()); i++) {
    if (s[i] != ' ') s[pos++] = s[i];
  }
  s.resize(pos);
}
int main() {
  ios_base::sync_with_stdio(0);
  string s;
  vector<string> vs;
  vector<bool> ck;
  while (getline(cin, s)) {
    if (!isAmplifying(s)) {
      removeSpace(s);
      ck.push_back(false);
    } else {
      ck.push_back(true);
    }
    vs.push_back(s);
  }
  for (int i = 0; i < (int)(vs.size()); i++) {
    cout << vs[i];
    if (ck[i] || (i + 1 < vs.size() && ck[i + 1]) || i + 1 == vs.size())
      cout << endl;
  }
  return 0;
}
