#include <bits/stdc++.h>
using namespace std;
char x[1500001];
int k, i, starti, fini;
bool start, finish, found[500001];
int main() {
  while (cin.getline(x, 1500001)) {
    k++;
    found[k] = false;
    int a = strlen(x);
    for (i = 0; i < a; i++) {
      if (x[i] != ' ' && x[i] != '#' && !found[k]) break;
      if (x[i] == '#') {
        found[k] = true;
        break;
      }
    }
    if (found[k]) {
      if (!found[k - 1] && k != 1) cout << "\n";
      cout << x << "\n";
    } else {
      int p = strlen(x);
      for (i = 0; i < p; i++) {
        if (x[i] == ' ') {
          continue;
        } else
          cout << x[i];
      }
    }
  }
  if (!found[k]) cout << "\n";
}
