#include <bits/stdc++.h>
using namespace std;
unsigned long long size(char *&p) {
  unsigned long long res = 0;
  while (p[res++] != '\0')
    ;
  return res - 1;
}
bool is_char(char *&p) {
  unsigned long long int i;
  unsigned long long int len = size(p);
  for (i = 0; (i < len && p[i] == ' '); i++)
    ;
  if (i < len)
    if (p[i] == '#') return true;
  return false;
}
void cout_norm(char *&p) {
  unsigned long long len = size(p);
  unsigned long long int i = 0;
  for (i = 0; i < len; i++)
    if (p[i] != ' ') cout << p[i];
}
int main() {
  char *p = new char[10000000];
  bool prev = false;
  bool first = true;
  while (cin.getline(p, 10000000)) {
    if (is_char(p)) {
      if (first != true) cout << endl;
      cout << p;
      prev = true;
      first = false;
    } else {
      if (prev == true) cout << endl;
      cout_norm(p);
      prev = false;
      first = false;
    }
  }
  cout << endl;
  delete[] p;
  return 0;
}
