#include <bits/stdc++.h>
using namespace std;
const int mod(1000000007);
const int inf(INT_MAX);
const int MAXN(2000005);
vector<string> a;
char s[MAXN];
int amp[MAXN] = {0};
int main() {
  while (gets(s) != NULL) a.push_back(s);
  for (int i = 0; i < a.size(); i++) {
    int k = 0;
    while (a[i][k] == ' ' && k < a[i].size()) k++;
    if (k < a[i].size() && a[i][k] == '#') amp[i] = 1;
  }
  string b;
  bool chk = 0;
  for (int i = 0; i < a.size(); i++) {
    if (amp[i] == 1) {
      if (chk) cout << b << endl;
      b.clear();
      cout << a[i] << endl;
      chk = 0;
    } else {
      for (int j = 0; j < a[i].size(); j++)
        if (a[i][j] != ' ') b += a[i][j];
      chk = 1;
    }
  }
  if (chk) cout << b << endl;
}
