Problem1630--Border

1630: Border

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 0  Solved: 0
[Submit] [Status] [Web Board] [Creator:]

Description

You are to write a program that draws a border around a closed path into a bitmap, as displayed in the following figure:

Input

The first line of the input file contains the number of test cases in the file. Each test case that follows consists of two lines. The first line of each case contains two integer numbers x and y specifying the starting point of the path. The second line contains a string of variable length. Every letter in the string symbolizes a move of length one along the grid. Only the letters 'W' (

Output

For each test case, output a line with the number of the case ('Bitmap #1', 'Bitmap #2', etc.). For each row of the bitmap from top to bottom, print a line where you print a character for every bit in that row from left to right. Print an uppercase 'X' for set bits and a period '.' for unset bits. Output a blank line after each bitmap.

Sample Input Copy

1
2 1
EENNWNENWWWSSSES.

Sample Output Copy

Bitmap #1
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
.XXX............................
X...X...........................
X..X............................
X...X...........................
.X..X...........................
..XX............................

Source/Category

87