#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const int INF = 1000000000;
const int MOD = 1000000007;
int main() {
  string str;
  int t = 0;
  while (getline(cin, str)) {
    int i = 0;
    while (i < str.size() && str[i] == ' ') {
      i++;
    }
    if (i < str.size() && str[i] == '#') {
      if (t == 1) {
        cout << endl;
      }
      t = 0;
      cout << str << endl;
    } else {
      t = 1;
      for (int k = i; k < str.size(); k++) {
        if (str[k] != ' ') {
          cout << str[k];
        }
      }
    }
  }
  if (t == 1) {
    cout << endl;
  }
  return 0;
}
