#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int f = 1, i;
  while (getline(cin, s)) {
    int l = s.length();
    for (i = 0; i < l; i++) {
      if (s[i] != ' ') break;
    }
    if (s[i] == '#') {
      if (f == 0) {
        printf("\n");
      }
      cout << s << endl;
      f = 1;
    } else {
      for (i = 0; i < l; i++) {
        if (s[i] == ' ') continue;
        cout << s[i];
      }
      f = 0;
    }
  }
  if (f == 0) {
    cout << endl;
  }
  return 0;
}
