#include <bits/stdc++.h>
using namespace std;
int main() {
  bool last = 1;
  string str;
  while (getline(cin, str)) {
    bool yes;
    long long len = (int)str.length();
    long long ind = 0;
    for (ind = 0; ind < len; ind++)
      if (str[ind] != ' ') break;
    if (str[ind] == '#')
      yes = 1;
    else
      yes = 0;
    if (yes) {
      if (!last) {
        puts("");
        cout << str << '\n';
      } else
        cout << str << '\n';
    } else {
      for (int i = ind; i < len; i++)
        if (str[i] != ' ') putchar(str[i]);
    }
    last = yes;
  }
  if (!last) puts("");
  return 0;
}
