#include <bits/stdc++.h>
using namespace std;
string buf;
void ccout(string s) {
  for (int(i) = 0; (i) < (int)(s.size()); (i)++)
    if (!isspace(s[i])) putchar(s[i]);
}
bool isamp(string s) {
  for (int(i) = 0; (i) < (int)(s.size()); (i)++) {
    if (s[i] == ' ') continue;
    if (s[i] != '#')
      return false;
    else
      return true;
  }
  return false;
}
bool isnl(string s) { return s[0] == '\n'; }
enum { em, sp, o, nl };
int main() {
  int stat = em, cl = 0;
  while (getline(cin, buf)) {
    switch (stat) {
      case em:
        if (isamp(buf)) {
          stat = sp;
          cout << buf << endl;
        } else if (!isnl(buf)) {
          stat = o;
          ccout(buf);
        }
        break;
      case sp:
        if (isamp(buf))
          cout << buf << endl;
        else if (isnl(buf)) {
          cl++;
          stat = nl;
        } else {
          stat = o;
          ccout(buf);
        }
        break;
      case o:
        if (isamp(buf)) {
          puts("");
          cout << buf << endl;
          stat = sp;
        } else if (!isnl(buf))
          ccout(buf);
        break;
      case nl:
        if (isamp(buf)) {
          cl++;
          for (int(i) = 0; (i) < (int)(cl); (i)++) puts("");
          cout << buf << endl;
          stat = sp;
        } else if (isnl(buf))
          cl++;
        else {
          ccout(buf);
          stat = o;
          cl = 0;
        }
      default:
        break;
    }
  }
  if (stat == o) puts("");
  return 0;
}
