#include <bits/stdc++.h>
using namespace std;
int main() {
  string str, output = "";
  int cnt = 0;
  while (getline(cin, str)) {
    int pos = 0;
    while (pos < str.size() && str[pos] == ' ') pos++;
    if (pos < str.size() && str[pos] == '#') {
      if (!cnt)
        cout << str << "\n";
      else {
        cout << output << "\n" << str << "\n";
      }
      output = "";
      cnt = 0;
    } else {
      for (int i = 0; i < str.size(); i++)
        if (str[i] != ' ') output.push_back(str[i]);
      cnt++;
    }
  }
  if (cnt) cout << output << "\n";
  return 0;
}
