#include <bits/stdc++.h>
using namespace std;
int usuitakumi(string emirhan) {
  int looping = 0;
  if (emirhan[0] == '\n') return -1;
  for (; looping < emirhan.size();) {
    if (emirhan[looping] == ' ') {
      looping++;
      continue;
    } else if (emirhan[looping] == '\n')
      return -1;
    else if (emirhan[looping] == '#')
      return 1;
    else
      return 0;
  }
  return 0;
}
string duzelt(string emirhan) {
  string ayuzawa = "";
  for (int looping = 0; looping < emirhan.size(); looping++)
    if (emirhan[looping] != ' ' && emirhan[looping] != '	')
      ayuzawa += emirhan[looping];
  return ayuzawa;
}
void solve() {
  string emirhan;
  int a;
  bool begci = 0;
  while (1) {
    getline(cin, emirhan);
    if (cin.eof()) break;
    a = usuitakumi(emirhan);
    if (a == 1) {
      if (begci) cout << endl;
      cout << emirhan << endl;
      begci = 0;
      continue;
    } else if (a == 0)
      emirhan = duzelt(emirhan);
    cout << emirhan;
    begci = true;
  }
  if (begci) cout << endl;
}
int main() {
  solve();
  return 0;
}
