#include <bits/stdc++.h>
using namespace std;
bool cmp(pair<int, int> a, pair<int, int> b) {
  if (a.first > b.first)
    return 1;
  else if (a.first == b.first && a.second < b.second)
    return 1;
  else if (a.first > b.first && a.second == b.second)
    return 1;
  return false;
}
int main() {
  string s;
  int j, k = 0;
  while (getline(cin, s)) {
    for (j = 0; j < s.length(); j++)
      if (s[j] != ' ') break;
    if (j == s.length() || s[j] != '#') {
      if (k == 2) cout << endl;
      for (j = 0; j < s.length(); j++)
        if (s[j] != ' ') cout << s[j];
      k = 1;
    } else {
      if (k) cout << endl;
      cout << s;
      k = 2;
    }
  }
  cout << endl;
  return 0;
}
