#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::string;
int main() {
  bool newline = true;
  bool found;
  for (string s; getline(cin, s);) {
    found = false;
    for (string::size_type index = 0; index < s.size(); ++index)
      if (s[index] != ' ')
        if (s[index] == '#')
          found = true;
        else
          break;
    if (found) {
      if (!newline) cout << std::endl;
      cout << s << std::endl;
      newline = true;
    } else {
      for (string::size_type index = 0; index < s.size(); ++index)
        if (s[index] != ' ') cout << s[index];
      newline = false;
    }
  }
  if (!found) cout << std::endl;
}
