#include <bits/stdc++.h>
using namespace std;
vector<string> res;
int main() {
  string line;
  bool flag = 0;
  while (getline(cin, line)) {
    int pos = line.find_first_not_of(" ");
    if (pos == -1 || line[pos] != '#') {
      string a = "";
      for (int i = 0; i < line.size(); i++)
        if (line[i] != ' ') a += line[i];
      if (flag)
        res.back() += a;
      else
        res.push_back(a);
      flag = 1;
    } else {
      flag = 0;
      res.push_back(line);
    }
  }
  for (int i = 0; i < res.size(); i++) cout << res[i] << '\n';
  return 0;
}
