#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
int main() {
  char srcStr[1048580];
  char destStr[1048580];
  int srcStrSize;
  int srcStrIter;
  int destStrIter;
  bool previousForce = false;
  bool firstStr = true;
  while (!std::cin.eof()) {
    std::cin.getline(srcStr, 1048580);
    srcStrSize = strlen(srcStr);
    if ((srcStrSize == 0) && (std::cin.eof())) break;
    srcStrIter = 0;
    while ((srcStrIter < srcStrSize) && (srcStr[srcStrIter] == ' '))
      srcStrIter++;
    if ((srcStrIter < srcStrSize) && (srcStr[srcStrIter] == '#')) {
      if (firstStr)
        std::cout << srcStr;
      else
        std::cout << std::endl << srcStr;
      previousForce = true;
    } else {
      destStrIter = 0;
      while (srcStrIter < srcStrSize) {
        if (srcStr[srcStrIter] != ' ')
          destStr[destStrIter++] = srcStr[srcStrIter++];
        else
          srcStrIter++;
      }
      destStr[destStrIter] = 0;
      if (previousForce) {
        std::cout << std::endl << destStr;
        previousForce = false;
      } else
        std::cout << destStr;
    }
    firstStr = false;
  }
  std::cout << std::endl;
  return 0;
}
