#include <bits/stdc++.h>
using namespace std;
const int M = 1000000 + 10;
char in[M];
int main() {
  string s;
  int last = 0;
  while (getline(cin, s)) {
    int slen = s.length();
    int i = 0;
    while (i < slen && s[i] == ' ') {
      i++;
    }
    if (s[i] == '#') {
      if (last == 1) {
        cout << endl;
      }
      string t = "";
      cout << s << endl;
      last = 0;
    } else {
      for (int j = 0; j < slen; j++) {
        if (s[j] != ' ') {
          cout << s[j];
        }
      }
      last = 1;
    }
  }
  if (last == 1) {
    cout << endl;
  }
  return 0;
}
