#include <bits/stdc++.h>
using namespace std;
const int maxn = 1048576 + 5;
string s;
int main() {
  bool flag = false;
  while (getline(cin, s)) {
    bool is = false;
    for (int i = 0; i < s.size(); i++) {
      if (s[i] == '#') {
        if (flag) cout << endl;
        cout << s << endl;
        is = true;
        flag = false;
      }
      if (s[i] != ' ') break;
    }
    if (!is) {
      for (int i = 0; i < s.size(); i++) {
        if (s[i] != ' ') cout << s[i];
      }
      flag = true;
    }
  }
  if (flag) cout << endl;
  return 0;
}
