#include <bits/stdc++.h>
char s[1048666];
int main() {
  bool end = true;
  while (gets(s)) {
    bool amp = false;
    for (int i = 0; s[i]; ++i) {
      if (s[i] == ' ') continue;
      if (s[i] == '#') {
        amp = true;
        break;
      } else
        break;
    }
    if (amp) {
      if (!end) {
        end = true;
        putchar('\n');
      }
      puts(s);
    } else {
      end = false;
      for (int i = 0; s[i]; ++i) {
        if (s[i] == ' ') continue;
        putchar(s[i]);
      }
    }
  }
  if (!end) {
    end = true;
    putchar('\n');
  }
  return 0;
}
