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