#include <bits/stdc++.h>
using namespace std;
bool sharpf(const string& s) {
  int i = 0;
  while (i < s.length() && s[i] == ' ') ++i;
  if (i < s.length() && s[i] == '#') {
    return true;
  } else {
    return false;
  }
}
int main() {
  string s;
  bool boo = false;
  getline(cin, s);
  if (sharpf(s)) {
    cout << s << endl;
    s = "";
  } else {
    string tmp;
    for (int i = 0; i < s.length(); ++i) {
      if (s[i] != ' ') {
        tmp += s[i];
      }
    }
    s = tmp;
    boo = true;
  }
  string s1;
  while (getline(cin, s1)) {
    if (sharpf(s1)) {
      if (boo) {
        cout << s << endl;
        s = "";
        boo = false;
      }
      cout << s1 << endl;
    } else {
      for (int i = 0; i < s1.length(); ++i) {
        if (s1[i] != ' ') {
          s += s1[i];
        }
      }
      boo = true;
    }
  }
  if (boo) {
    cout << s << endl;
  }
  return 0;
}
