#include <bits/stdc++.h>
char str[(1 << 21)];
char line[(1 << 21)];
int cp = 0, lp = 0;
bool pl = 0;
int main() {
  while (fgets(line, (1 << 21), stdin) != NULL) {
    lp = 0;
    while (line[lp] == ' ') lp++;
    if (line[lp] == '#') {
      if (pl) {
        str[cp] = '\0';
        printf("%s\n", str);
        cp = 0;
        pl = 0;
      }
      lp = 0;
      while (line[lp] != '\r' && line[lp] != '\n') lp++;
      line[lp] = '\0';
      printf("%s\n", line);
    } else {
      lp = 0;
      while (line[lp] != '\r' && line[lp] != '\n') {
        if (line[lp] != ' ') str[cp++] = line[lp];
        lp++;
      }
      pl = 1;
    }
  }
  if (pl) {
    str[cp] = '\0';
    printf("%s\n", str);
  }
  return 0;
}
