#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:64000000")
using namespace std;
const int INF = (int)1E9;
const long long INF64 = (long long)1E18;
const long double EPS = 1E-9;
const long double PI = 3.1415926535897932384626433832795;
bool good(const string &s) {
  for (int i = 0; i < (int)(s.size()); i++)
    if (s[i] != ' ') return s[i] == '#';
  return false;
}
string recalc(const string &s) {
  string ans = "";
  for (int i = 0; i < (int)(s.size()); i++)
    if (s[i] != ' ') ans += s[i];
  return ans;
}
int main() {
  vector<string> a;
  string s;
  while (getline(cin, s)) a.push_back(s);
  vector<string> ans;
  for (int i = 0; i < (int)(a.size()); i++)
    if (good(a[i]))
      ans.push_back(a[i]);
    else if (i == 0)
      ans.push_back(recalc(a[i]));
    else {
      if (good(ans.back()))
        ans.push_back(recalc(a[i]));
      else
        ans.back() += recalc(a[i]);
    }
  for (int i = 0; i < (int)(ans.size()); i++) cout << ans[i] << endl;
  return 0;
}
