#include <bits/stdc++.h>
using namespace std;
vector<pair<string, int> > out;
int main() {
  ios_base::sync_with_stdio(false);
  string str;
  while (getline(cin, str, '\n')) {
    if (out.empty()) {
      if (str.find_first_not_of(" ") == str.find('#') &&
          str.find('#') != string::npos)
        out.push_back(make_pair((str), (1)));
      else
        out.push_back(make_pair((str), (0)));
    } else {
      int f = (str.find_first_not_of(" ") == str.find('#') &&
               str.find('#') != string::npos);
      if (f || out.back().second)
        out.push_back(make_pair((str), (f)));
      else
        out.back().first += str;
    }
  }
  for (auto x : out) {
    int f = x.second;
    string str = x.first;
    if (f)
      cout << str << endl;
    else {
      for (int i = 0; i < str.length(); i++)
        if (str[i] != ' ') cout << str[i];
      cout << endl;
    }
  }
  return 0;
}
