#include <bits/stdc++.h>
using namespace std;
string removeSp(string& s) {
  string ans = "";
  for (int i = 0; i < s.length(); i++) {
    if (s[i] != ' ') ans += s[i];
  }
  return ans;
}
bool isP(string& s) {
  for (int i = 0; i < s.length(); i++) {
    if (s[i] != ' ' && s[i] != '#')
      return false;
    else if (s[i] == '#')
      return true;
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string s;
  vector<string> curr;
  while (getline(cin, s)) {
    bool p = isP(s);
    if (p) {
      if (curr.size() != 0) {
        for (int i = 0; i < curr.size(); i++) cout << curr[i];
        curr.clear();
        cout << "\n";
      }
      cout << s << "\n";
    } else {
      s = removeSp(s);
      curr.push_back(s);
    }
  }
  if (curr.size() != 0) {
    for (int i = 0; i < curr.size(); i++) cout << curr[i];
    curr.clear();
    cout << "\n";
  }
  return 0;
}
