#include <bits/stdc++.h>
const long long INF = 1000000007;
const double cp = 2 * asin(1.0);
const double eps = 1e-9;
const long long mod = 1000000007;
using namespace std;
int main() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  string s;
  vector<string> second;
  vector<int> ans;
  while (getline(cin, s)) {
    int len = s.size();
    int pos = 0;
    while (pos < len && s[pos] == ' ') pos++;
    if (pos < len && s[pos] == '#') {
      ans.push_back(1);
      second.push_back(s);
    } else {
      string v;
      ans.push_back(0);
      for (int i = 0; i < len; i++)
        if (s[i] != ' ') v.push_back(s[i]);
      second.push_back(v);
    }
  }
  cout << (second[0]);
  for (int a = 0, b = 1; b < second.size(); a++, b++) {
    if (ans[a] == 0 && ans[b] == 0) {
      cout << second[b];
    } else
      cout << endl << second[b];
  }
  cout << endl;
  return 0;
}
