#include <bits/stdc++.h>
using namespace std;
bool is(string s) {
  for (int i = 0; i < s.length(); ++i) {
    if (s[i] == '#')
      return 1;
    else if (!isspace(s[i]))
      return 0;
  }
  return 0;
}
int main() {
  string s;
  bool line = 0;
  while (getline(cin, s)) {
    if (is(s)) {
      if (line) {
        cout << '\n';
        line = 0;
      }
      cout << s << '\n';
    } else {
      line = 1;
      for (int i = 0; i < s.length(); ++i) {
        if (!isspace(s[i])) cout << s[i];
      }
    }
  }
  if (line) cout << '\n';
  return 0;
}
