object Main extends App {
  var ls: List[String] = Nil
  for(line <- scala.io.Source.stdin.getLines) {
    ls = line(0) match {
      case '*'|'.' => line :: line :: ls
      case _       => ls
    }
  }
  println(ls.reverse.mkString("\n"))
}
