#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  bool prev = false;
  bool first = true;
  while (getline(cin, s)) {
    int i = 0;
    while (s[i] == ' ') i++;
    if (s[i] == '#') {
      if (!first) cout << endl;
      cout << s;
      prev = true;
    } else {
      if (prev) cout << endl;
      prev = false;
      string buf = "";
      for (int32_t i = (0); i < int32_t(s.size()); ++i)
        if (s[i] != ' ') {
          buf += s[i];
        }
      cout << buf;
    }
    first = false;
  }
  if (!first) cout << endl;
  return 0;
}
