#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 5;
const long long INF = 1e9 + 9;
const long long MOD = 1000000007;
int main() {
  string s;
  vector<string> all;
  while (getline(cin, s)) all.push_back(s);
  int n = all.size();
  bool ok;
  vector<bool> yes;
  for (int i = 0; i < n; i++) {
    ok = false;
    for (int j = 0; j < all[i].size(); j++)
      if (all[i][j] != ' ') {
        ok = (all[i][j] == '#');
        break;
      }
    yes.push_back(ok);
  }
  for (int i = 0; i < n; i++) {
    if (yes[i])
      cout << all[i] << endl;
    else {
      string r = "";
      ok = false;
      for (; i < n; i++) {
        if (yes[i]) {
          ok = true;
          break;
        }
        for (int j = 0; j < all[i].size(); j++)
          if (all[i][j] != ' ') r += all[i][j];
      }
      if (ok) i--;
      cout << r << endl;
    }
  }
  return 0;
}
