#include <bits/stdc++.h>
using namespace std;
inline int nxt() {
  int a;
  scanf("%d", &a);
  return a;
}
inline long long int NXT() {
  long long int a;
  scanf("%lld", &a);
  return a;
}
struct debugger {
  template <typename T>
  debugger& operator,(const T& v) {
    cerr << v << " ";
    return *this;
  }
} dbg;
int main() {
  ios_base::sync_with_stdio(0);
  string s, ans;
  int p = 0;
  int space = 0;
  int ne = 0;
  while (getline(cin, s)) {
    int len = s.size();
    int flag = 0, amp = 0;
    for (int i = 0; i < s.size(); i++) {
      if (s[i] == ' ' && flag == 0)
        continue;
      else if (s[i] == '#' && flag == 0) {
        amp = 1;
        break;
      } else if (s[i] == ' ')
        continue;
      else {
        flag = 1;
        ans.push_back(s[i]);
      }
    }
    if (amp) {
      if (p == 0) {
        if (ans.size() || ne) cout << ans << endl;
        cout << s << endl;
        ans.clear();
        p = 1;
      } else {
        if (ne) cout << ans << endl;
        cout << s << endl;
        ans.clear();
      }
      ne = 0;
      continue;
    }
    ne = 1;
  }
  if (ans.size() != 0 || ne) cout << ans << endl;
}
