#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
using ll = long long;
using ld = long double;
using D = double;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
template <typename T>
T sqr(T a) {
  return a * a;
}
template <typename T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <typename T>
T sgn(T a) {
  return a > 0 ? 1 : (a < 0 ? -1 : 0);
}
template <typename T>
T abs(T a) {
  return a > 0 ? a : -a;
}
const int inf = 2e9;
const ld st = 0.000001;
const ld pi = acos((ld)-1);
const ll MAXN = 1000000000 + 100;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL), cout.tie(NULL);
  string s;
  string s1;
  bool tr1 = true;
  while (getline(cin, s)) {
    bool tr = false;
    for (int i = 0; i < ((int)s.size()); i++) {
      if (s[i] == ' ') {
        continue;
      }
      if (s[i] == '#') {
        tr = true;
        break;
      } else {
        tr = false;
        break;
      }
    }
    if (tr) {
      if (tr1 == false) {
        cout << s1 << "\n";
        s1 = "";
        tr1 = true;
      }
      cout << s << "\n";
    } else {
      string s2;
      for (int i = 0; i < ((int)s.size()); i++) {
        if (s[i] != ' ') {
          s2 += s[i];
        }
      }
      tr1 = false;
      s1 += s2;
    }
  }
  if (tr1 == false) {
    cout << s1 << "\n";
  }
  return 0;
}
