#include <bits/stdc++.h>
using namespace std;
vector<string> s, ans;
char ts[1048576];
int n, is[1048576], ni[1048576];
int main() {
  while (gets(ts)) s.push_back(ts);
  n = s.size();
  for (int i = 0; i < n; i++) {
    is[i] = 0;
    int l = s[i].size();
    int x = 0;
    while (x < l && s[i][x] == ' ') ++x;
    if (x < l && s[i][x] == '#') is[i] = 1;
  }
  for (int i = 0; i < n; i++) {
    if (is[i])
      cout << s[i] << endl;
    else {
      int l = s[i].size();
      for (int j = 0; j < l; j++)
        if (s[i][j] != ' ') cout << s[i][j];
      if (i < n && is[i + 1] || i == n - 1) cout << endl;
    }
  }
}
