No.3261 yiwiy9 → yiwiY9
タグ : / 解いたユーザー数 206
作問者 :
のらら
/ テスター :
ゆにたりー卿
DeltaStruct
Andrew8128
kazuppa
👑
bolero
Rice_tawara459
よには
yimiya(いみや)
Problem Statement
The user ID yiwiy9 of Iwai Seijin on competitive programming sites looks like a face. i looks like the eyes, w the mouth, y the hands, and 9 a tail or something.
There are $2$ kinds of Iwai Seijin: yiwiy9 is a right-leaning Iwai Seijin, and 9yiwiy is a left-leaning Iwai Seijin.
There is a grid with $H$ rows and $W$ columns in which Iwai Seijin are lined up. The state of row $i(1 \leq i \leq H)$ of the grid is given by a string $S_i$ of length $W$, where
a place with a right-leaning Iwai Seijin is represented by the $6$-character substring yiwiy9,
a place with a left-leaning Iwai Seijin is represented by the $6$-character substring 9yiwiy,
and a place with neither kind of Iwai Seijin is represented by ..
All Iwai Seijin are lined up without overlapping each other (= no $2$ or more Iwai Seijin share $1$ or more characters).
Output the state of the grid after every Iwai Seijin in the grid raises the hand on the side it is leaning toward.
Specifically, change each right-leaning Iwai Seijin to yiwiY9 and each left-leaning Iwai Seijin to 9Yiwiy.
Constraints
yiwiy9, 9yiwiy and .yiwiy9 and 9yiwiy representing each Iwai Seijin are placed without overlapping each otherInput
The input is given from standard input in the following format.
$H\ W$ $S_1$ $S_2$ : $S_H$
Output
Output $H$ lines representing the state of the grid after every Iwai Seijin in the grid raises the hand on the side it is leaning toward.
Sample
Sample 1
Input
2 8 ..yiwiy9 9yiwiy..
Output
..yiwiY9 9Yiwiy..
The Iwai Seijin in row $1$ is right-leaning, and the Iwai Seijin in row $2$ is left-leaning. When they raise the hand on the side they are leaning toward, the grid becomes as shown. Cute, isn't it ´・ω・`
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。