#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  string s;
  int c = -1;
  while (getline(cin, s)) {
    int i = 0;
    for (i = 0; i < s.size(); i++) {
      if (s[i] != ' ') break;
    }
    if (i == s.size() || s[i] != '#') {
      if (c == 2) cout << endl;
      for (int j = 0; j < s.size(); j++)
        if (s[j] != ' ') cout << s[j];
      c = 1;
      continue;
    }
    if (c == 2 || c == 1) cout << endl;
    cout << s;
    c = 2;
  }
  cout << endl;
}
