There are more test cases. Each test case starts with a line containing two integers M, N
(2 ≤ M, N ≤ 1 000) and a printable ASCII character C enclosed in single quotes. The values
on the line are separated by spaces. Next, there are M lines, one empty line, and other M
lines. The first M lines represent the first frame, the last M lines represent the second frame.
Each nonempty line contains string of exactly N printable ASCII characters. Each character
represents one pixel of the original frame. Each frame contains a complete silhouette of the
falcon. In both frames all silhouette pixels are represented by the character C and all pixels
which do not belong to the silhouette are represented by characters other than C. The pixels
of the silhouettes in both frames do not overlap even partially, in other words, no coordinates
of a pixel of the silhouette in the first frame are the same as the coordinates of any pixel of the
silhouette in the second frame. The shapes of the silhouettes in both frames are identical. The
silhouette in any frame can be shifted by some number of pixels horizontally and/or vertically so that its position exactly matches the position of the silhouette in the other frame. The silhouettes do not rotate. For various technical reasons the silhouette image might not be connected, it may comprise of more disconnected regions in the frame. A printable ASCII character is an element of the subset of ASCII characters starting with the exclamation mark character (’!’, ASCII code 33 in decimal) and ending with the tilde character (’~’, ASCII code 126 in decimal). There is a blank line between successive cases. The input is terminated by a line containing “0 0 ’ ’”.
For each test case, print a picture frame consisting of M lines with N characters each. The
frame should represent the result of exact extrapolation of the falcon’s movement based on the
two input frames. If the silhouette image in the second input frame is shifted horizontally and
vertically by some number of pixels relatively to the first input frame then the silhouette image
in the result frame should be shifted horizontally and vertically by the same number of pixels
relatively to the second frame. It is possible that the falcon’s silhouette might appear in the
frame picture only partially or it may not appear there at all. Print one empty line after each
case.
2 2 ’X’ X^ -- .X -- 3 12 ’A’ ABABABABABAC BABABABABABB ABABABABABAB BABABABABABA BBABABABABAB BABABABABABA 6 26 ’>’ ../||\........OO......\|/. >//||\\.....OOOOOO....-0-. />>>|\\\....OOOOOO..../|\. ..>||........OOOO......... ...||.........||.......... |||||||||||||||||||||||||| ../||\.....>..OO......\|/. .//||\\.....>>>OOO....-0-. ///||\\\....O>OOOO..../|\. ...||........OOOO......... ...||.........||.......... |||||||||||||||||||||||||| 0 0 ’ ’
· · \n \n \n \n \n \n \n · · \n \n \n \n \n \n \n \n \n · · \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n · · · \n
.^ -- BBABABABABAC BBBABABABABA BBABABABABAB ../||\........OO......\>>> .//||\\.....OOOOOO....-0>. ///||\\\....OOOOOO..../|\. ...||........OOOO......... ...||.........||.......... ||||||||||||||||||||||||||
\n \n \n \n \n \n \n \n \n \n \n \n \n