Sniffer ------- Sniffer has the task of marking the trail through the Hungry Woods so her pack can travel it quickly at night. Fortunately the path does not have any forks, so no searching is required, but sometimes its hard to see which way the path goes. The path and forest are represented by an array of char- acters which is a map of the forest area. The edges of this map array are marked with `+'s at the corners, `-'s at top and bottom, and `|'s at the edges. Within the map `#' represents impassable forest and ` ' (single space) represents the path or open passable forest. The path starts at the upper left corner (array row 2, column 2) but may exit anywhere next to a map edge. Sniffer and her pack members can only move on the path by going left, right, up, or down; they CANNOT go dia- gonally. At any point on the path there is at most one way to continue onward. Note that the path may run along the edge of the map. The path ends when there is no way to move forward, and Sniffer knows that the path will not deadend inside the forest (i.e., surrounded by `#'s). Sniffer marks the path by changing the ` ' space charac- ters that are on the path from ` ' to `:'. Input ----- For each of several test cases, first a line containing the test case name, then R lines each containing C char- acters, which encode the array. Each of the characters in the R lines is `+', `-', `|', `#', or ` ' and repre- sents one element of the array. R is the number of rows in the array and C the number of columns, and each row line has exactly C characters. The R array lines are followed by a line containing just `.' that ends the test case. 6 <= R,C <= 50. No line, including the test case name line, is longer than 80 characters. The input ends with an end of file. Output ------ For each test case, an exact copy of the input for the test case, but with array characters on the path changed from ` ' to `:'. Sample Input ------ ----- -- SAMPLE 1 -- +----------+ | # #### #| |# ## ##| |# ## ## | |# # ###| |###### | +----------+ . -- SAMPLE 2 -- +------------------------------+ | # ######### # # # #| | # # ###### #### ######| | ### ###### ###### # # ######| | ###### # # #| |###### ######### ##### | +------------------------------+ . Sample Output ------ ------ -- SAMPLE 1 -- +----------+ |::# #### #| |#:##::::##| |#:##:##:::| |#::::# ###| |###### | +----------+ . -- SAMPLE 2 -- +------------------------------+ |:# ######### #::::::# # #| |:# #::::::::######:####:######| |:###:######:######:# #:######| |:::::######::::::::# #::::::#| |###### ######### #####::| +------------------------------+ . File: sniffer.txt Author: Bob Walton Date: Mon Oct 10 00:47:29 EDT 2011 The authors have placed this file in the public domain; they make no warranty and accept no liability for this file. RCS Info (may not be true date or author): $Author: walton $ $Date: 2011/10/10 04:47:38 $ $RCSfile: sniffer.txt,v $ $Revision: 1.5 $