#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const int mod = 1e9 + 7;
void solve() {
  string ans = "", s;
  bool last = 0;
  while (getline(cin, s)) {
    bool f = 0;
    for (int i = 0; i < s.size(); i++) {
      if (s[i] != ' ') {
        f = (s[i] == '#');
        break;
      }
    }
    if (f) {
      if (last) cout << ans << endl;
      ans = "";
      cout << s << endl;
      last = 0;
    } else {
      last = 1;
      string tmp = "";
      for (int i = 0; i < s.size(); i++) {
        if (s[i] != ' ') tmp += s[i];
      }
      ans += tmp;
    }
  }
  if (last) cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) solve();
  return 0;
}
