#include <bits/stdc++.h>
using namespace std;
string input[1000024], last;
bool lastNL = false;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  for (int i = 0; getline(cin, input[i]); i++) {
    bool a = false;
    for (int j = 0; j < input[i].size(); j++) {
      if (input[i][j] != ' ') {
        a = (input[i][j] == '#');
        break;
      }
    }
    if (a) {
      cout << last;
      if (lastNL) {
        cout << "\n";
      }
      cout << input[i] << "\n";
      last = string();
      lastNL = 0;
    } else {
      for (int j = 0; j < input[i].size(); j++) {
        if (input[i][j] != ' ') {
          last += input[i][j];
        }
      }
      lastNL = 1;
    }
  }
  cout << last;
  if (lastNL) {
    cout << "\n";
  }
  return 0;
}
