#include <bits/stdc++.h>
using namespace std;
const int inf = 2000000000;
int main() {
  char c;
  string s = "";
  bool prev = false;
  int i, sum = 0;
  while (getline(cin, s)) {
    for (i = 0; i < s.length() && s[i] == ' '; i++)
      ;
    if (i < s.length() && s[i] == '#') {
      prev = true;
      if (sum > 0) cout << endl;
      cout << s;
      sum++;
    } else {
      if (prev) cout << endl;
      prev = false;
      for (i = 0; i < s.length(); i++)
        if (s[i] != ' ') cout << s[i];
      sum++;
    }
  }
  cout << endl;
  return 0;
}
