#include <stdio.h>

int main(argc, argv)
int argc;
char *argv[];
{
  char buf[2048];
  while (fgets(buf, 2048, stdin))
  {
      if (*buf == '#')
      {
	if (*(buf + 1) != ' ')
        fprintf(stdout, "%s\n", buf);
      } 
      else if (*buf != '!')
        fprintf(stdout, "%s\n", buf);
  }
  return 0;
}
