#include <bits/stdc++.h>
using namespace std;
string line;
string buffer;
bool is_amp(string s) {
  int i = 0;
  while (i < s.size()) {
    if (s[i] == ' ') {
      i++;
      continue;
    } else
      return s[i] == '#';
  }
  return false;
}
int main() {
  bool first = true;
  bool last_is_amp = false;
  while (getline(cin, line)) {
    if (is_amp(line)) {
      if (!first && !last_is_amp) cout << buffer << endl;
      buffer = "";
      cout << line << endl;
      last_is_amp = true;
      first = false;
    } else {
      first = false;
      for (int i = 0; i < line.size(); i++)
        if (line[i] != ' ') buffer += line[i];
      last_is_amp = false;
    }
  }
  if (!last_is_amp) cout << buffer << endl;
  return 0;
}
