#include <bits/stdc++.h>
using namespace std;
int main() {
  bool ff = 0;
  string s, res = "";
  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 (ff) cout << res << '\n';
      res = "";
      cout << s << '\n';
      ff = 0;
    } else {
      ff = 1;
      string ans = "";
      for (int i = 0; i < s.size(); i++)
        if (s[i] != ' ') ans += s[i];
      res += ans;
    }
  }
  if (ff) cout << res << '\n';
  return 0;
}
