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