#P6368. Playing Card Back Design
Playing Card Back Design
Playing Card Back Design
In this problem, you are given the top-left quarter of a playing card back design. The quarter consists of (r) rows and (m) columns of characters, each of which is either #
or .
. The complete design is generated as follows:
- The given pattern is reflected horizontally along the vertical midline to form the top-right quarter.
- The entire top half (which now consists of the original left and its mirror right) is then reflected vertically along the horizontal midline to form the bottom half.
- Finally, a deliberate error is introduced by toggling the character at position ((x,y)) (1-indexed): if the character is
#
, it is changed to.
, and vice versa.
Your task is to output the final card back design, which will be of size (2r \times 2m).
inputFormat
The input consists of several lines:
- The first line contains two integers (r) and (m) ((1 \le r, m \le 100)), representing the number of rows and columns in the given top-left quarter.
- The second line contains two integers (x) and (y) ((1 \le x \le 2r,\ 1 \le y \le 2m)), which specify the position of the character to be toggled in the final design.
- The following (r) lines each contain a string of length (m), representing the top-left quarter of the pattern. Each character is either
#
or.
.
outputFormat
Output the final playing card back design, which is a (2r \times 2m) grid of characters. Each of the (2r) lines should contain a string of length (2m).
sample
1 1
1 1
#
.#
##
</p>