#include <bits/stdc++.h>
using namespace std;
bool firstc(string s) {
  bool ret = false;
  for (int i = 0; !ret && i < s.size(); ++i) {
    if (s[i] == ' ') continue;
    if (s[i] == '#')
      ret = true;
    else
      break;
  }
  return ret;
}
bool allspace(string s) {
  bool ret = true;
  for (int i = 0; ret && i < s.size(); ++i) {
    if (isspace(s[i]))
      continue;
    else
      ret = false;
  }
  return ret;
}
int main() {
  int T = 2;
  {
    string s;
    vector<string> v;
    while (getline(cin, s)) v.push_back(s);
    bool prev_amp = true;
    int i = 0;
    if (allspace(v[0]) && v.size() > 1 && firstc(v[1])) {
      cout << "\n" << v[1] << endl;
      i = 2;
    }
    while (i < v.size()) {
      if (firstc(v[i])) {
        if (!prev_amp) {
          cout << "\n" << v[i] << endl;
          prev_amp = true;
        } else
          cout << v[i] << endl;
      } else {
        prev_amp = false;
        for (int j = 0; j < v[i].size(); ++j)
          if (!isspace(v[i][j])) cout << v[i][j];
      }
      ++i;
    }
    if (!prev_amp) cout << endl;
  }
  return 0;
}
