#include <bits/stdc++.h>
using namespace std;
string s;
int main() {
  int i, j, k, r, w;
  int ok = 0, nok;
  while (getline(cin, s)) {
    int n = s.size();
    for (i = 0; i < n; i++)
      if (s[i] != ' ') break;
    if (i < n && s[i] == '#') {
      if (ok == 1) printf("\n");
      ok = 0;
      for (i = 0; i < n; i++) printf("%c", s[i]);
      printf("\n");
    } else {
      for (i = 0; i < n; i++)
        if (s[i] != ' ' && s[i] != '\n') printf("%c", s[i]);
      ok = 1;
    }
  }
  if (ok == 1) printf("\n");
  return 0;
}
