#include <bits/stdc++.h>
using namespace std;
vector<char> text;
int main() {
  ios_base::sync_with_stdio(false);
  text.clear();
  char s[2000006];
  cin.getline(s, 2000006);
  int ok = 0;
  while (!cin.eof()) {
    int ampl = 0;
    for (int i = 0; s[i] != NULL; ++i) {
      char ch = s[i];
      if (ch == '#') {
        ampl = 1;
        break;
      }
      if (ch != ' ') {
        break;
      }
    }
    if (!ampl) {
      ok = 1;
      for (int i = 0; s[i] != NULL; ++i) {
        char ch = s[i];
        text.push_back(ch);
      }
    } else {
      if (ok) {
        for (auto ch : text) {
          if (ch != ' ' && ch != 13 && ch != 10) cout << ch;
        }
        cout << '\n';
        text.clear();
      }
      ok = 0;
      cout << s << '\n';
    }
    cin.getline(s, 2000006);
  }
  if (ok) {
    for (auto ch : text)
      if (ch != ' ' && ch != 13 && ch != 10) cout << ch;
    cout << '\n';
    text.clear();
  }
  return 0;
}
