#include <bits/stdc++.h>
using namespace std;
int main() {
  string str, ret;
  bool f = false, prev = false;
  while (getline(cin, str)) {
    f = false;
    for (unsigned int i = 0; i < str.size(); i++) {
      if (str[i] != ' ') {
        if (str[i] == '#') {
          if (prev) {
            cout << ret << endl;
            prev = false;
            ret = "";
          }
          cout << str << endl;
          f = true;
        }
        break;
      }
    }
    if (!f) {
      string tmp;
      stringstream ss(str);
      while (ss >> tmp) {
        ret += tmp;
      }
      prev = true;
    }
  }
  if (prev) cout << ret << endl;
  return 0;
}
