#include <bits/stdc++.h>
using namespace std;
template <class Ta, class Tb>
inline void checkmin(Ta &a, Tb b) {
  if (b < a) a = b;
}
template <class T>
inline void checkmax(T &a, T b) {
  if (b > a) a = b;
}
template <class T>
inline int countbit(T n) {
  return (n == 0) ? 0 : (1 + countbit(n & (n - 1)));
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
template <class T>
inline T lowbit(T n) {
  return n & (-n);
}
template <class T>
inline T gcd(T a, T b) {
  if (a < 0) return gcd(-a, b);
  if (b < 0) return gcd(a, -b);
  return (b == 0) ? a : gcd(b, a % b);
}
template <class T>
inline T lcm(T a, T b) {
  if (a < 0) return lcm(-a, b);
  if (b < 0) return lcm(a, -b);
  return a * (b / gcd(a, b));
}
template <class T>
inline T euclide(T a, T b, T &x, T &y) {
  if (a < 0) {
    T d = euclide(-a, b, x, y);
    x = -x;
    return d;
  }
  if (b < 0) {
    T d = euclide(a, -b, x, y);
    y = -y;
    return d;
  }
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  } else {
    T d = euclide(b, a % b, x, y);
    T t = x;
    x = y;
    y = t - (a / b) * y;
    return d;
  }
}
const double pi = acos(-1.0);
const double ei = 2.718281828459;
const double eps = (1e-5);
const int Dx[8] = {-1, 0, 1, 0, -1, 1, 1, -1};
const int Dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int MAXN = 1000005;
const int MAXM = 50010;
const double inf = 1000000000;
const int mod = 123657;
using namespace std;
bool isamp(string line) {
  for (int i = 0; i < line.size(); i++) {
    if (isspace(line[i])) continue;
    if (line[i] == '#')
      return true;
    else
      return false;
  }
  return false;
}
string removespace(string line) {
  string ret = "";
  for (int i = 0; i < line.size(); i++)
    if (!isspace(line[i])) ret += line[i];
  return ret;
}
int main() {
  string line;
  bool has = false;
  string opt;
  while (getline(cin, line)) {
    if (isamp(line)) {
      if (has) {
        cout << opt << endl;
        has = false;
      }
      cout << line << endl;
      opt = "";
    } else {
      opt += removespace(line);
      has = true;
    }
  }
  if (has) cout << opt << endl;
}
