#include <bits/stdc++.h>
template <class T>
inline void checkmax(T &a, T b) {
  if (b > a) a = b;
}
template <class T>
inline void checkmin(T &a, T b) {
  if (b < a) a = b;
}
using namespace std;
int main(int argc, char const *argv[]) {
  string str, conc = "";
  bool pres = false;
  int line = 0;
  while (getline(cin, str)) {
    int l = str.size();
    bool dontchange = false;
    for (int i = 0; i < l; i++) {
      if (str[i] == '#') dontchange = true;
      if (str[i] != ' ') break;
    }
    if (dontchange) {
      if (pres) cout << conc << endl;
      cout << str << endl;
      pres = false;
      conc = "";
    } else {
      pres = true;
      for (int i = 0; i < l; i++)
        if (str[i] != ' ') conc += str[i];
    }
  }
  if (pres) cout << conc << endl;
  return 0;
}
