#include <bits/stdc++.h>
using namespace std;
char s[6100000], ret[6100000];
int top, l, pre;
inline int L(int i) { return i << 1; }
inline int R(int i) { return (i << 1) | 1; }
inline int B(int i) { return 1 << i; }
inline int low_bit(int x) { return x & (-x); }
int main() {
  string str;
  int prev = 1;
  int s = 1;
  while (getline(cin, str)) {
    int k = 0;
    for (int i = 0; i < str.size(); i++) {
      if (str[i] == ' ') continue;
      if (str[i] == '#') {
        k = 1;
        break;
      } else
        break;
    }
    if (k) {
      if (!prev && !s) cout << endl;
      cout << str << endl;
      prev = 1;
      s = 1;
    } else {
      for (int i = 0; i < str.size(); i++) {
        if (str[i] != ' ') cout << str[i];
      }
      prev = 0;
      s = 0;
    }
  }
  if (!s) cout << endl;
  return 0;
}
