1999 ACM Programming Contest Mid Atlantic Region
November 6, 1999 Problem 4
ASCII Art (ascii.cc)

When Usenet first began, netizens took pride in the quality of their ASCII art. As time has gone on, the rise of the B-grade monster browsers and integrated imaging programd has brought a decline in the quality of art netizens can expect in text-based messages (when people bother to use such a primitive format). One of the problems is size; some of the ASCII images are too small and other images are much too large, sometimes several screens wide. As head programmer at Usenet Central, you've decided to fix this problem with a program to improve some ASCII images. The program must magnify images that are too small and reduce images that are too large.

Problem Description: You are given an ASCII art picture as input, and the magnification it must be produced at. Magnifications can be positive or negative (reducing). The pictures consist of four ASCII characters: 'X', '/', '\', and spaces. Each of these characters can be magnified perfectly, as follows for double and triple magnification:

Normal         2           3

X              \/         \ /
               /\          X
                          / \


/               /           /
               /           /
                          /


\              \          \
                \          \
                            \

A positive magnification, such as 5, means that one character will become a 5x5 character. A negative number, such as -3, means that each 3x3 block will become one character. It will be possible to reduce all images by the given factor.

Input Format The input file will contain one or more data sets. Each data set will have the following format: The first line consists of three integers, the width, height, and magnification, in that order. The picture follows, with each row of the picture starting at the beginning of a new line. The picture consists entirely of the characters 'X', '/'. '\', and spaces. Other than the newlines, all characters in the file are in the picture. The maximum width and height are 500. The resulting image will not be more than 500x500. The input will terminate with end-of-file after the last image.

Output Format The output, sent to standard out, consists of the magnified pictures. Each picture is preceded by a line containing "picture #:" where # is the dataset in the file, counting from 1. The picture will start on a new line. A blank line follows each picture.



Sample Input:

2 2 2
\X
 X
2 1 2
 X
4 4 -2
\ \/
 \/\
  \/
  /\


Sample Output:

picture 1:
\ \/
 \/\
  \/
  /\

picture 2:
  \/
  /\

picture 3:
\X
 X