#include <bits/stdc++.h>
int main() {
  char input[1050000];
  int flag = 1;
  while (fgets(input, 1050000, stdin) != NULL) {
    for (int i = 0; input[i] != '\0'; i++) {
      if (input[i] == ' ') continue;
      if (input[i] == '#') {
        if (flag == 0) {
          printf("\n");
          flag = 1;
        }
        printf("%s", input);
        break;
      } else {
        flag = 0;
        for (int j = 0; input[j] != '\n'; j++) {
          if (input[j] != ' ') printf("%c", input[j]);
        }
        break;
      }
    }
  }
  if (flag == 0) printf("\n");
}
