#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:65777216")
using namespace std;
struct Y {
  int fir, sec;
};
bool cmp(Y i, Y j) {
  if (i.fir != j.fir) return i.fir < j.fir;
  return i.sec < j.sec;
}
char a[1048586];
int main() {
  string s;
  int r = 0;
  bool c = 0;
  while (getline(cin, s)) {
    bool b = 0;
    r++;
    int ls = s.length();
    for (int i = 0; i < ls; i++)
      if (s[i] != ' ') {
        if (s[i] == '#') b = 1;
        break;
      }
    if (b == 1) {
      if (r != 1) cout << endl;
      cout << s;
    } else {
      if (r != 1 && c == 1) cout << endl;
      for (int i = 0; i < ls; i++)
        if (s[i] != ' ') cout << s[i];
    }
    c = b;
    s.clear();
  }
  cout << endl;
  return 0;
}
