#include <bits/stdc++.h>
using namespace std;
char str[1100000];
int main() {
  bool isnew = 1;
  while (gets(str)) {
    char c = ' ';
    for (int i = 0; str[i]; i++)
      if (str[i] != ' ') {
        c = str[i];
        break;
      }
    if (c == '#') {
      if (!isnew) {
        isnew = 1;
        puts("");
      }
      puts(str);
    } else {
      isnew = 0;
      for (int i = 0; str[i]; i++)
        if (str[i] != ' ') {
          putchar(str[i]);
        }
    }
  }
  if (!isnew) puts("");
  return 0;
}
