問題一覧 > 通常問題

No.3261 yiwiy9 → yiwiY9

レベル : / AI推定難易度 : 101 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 206
作問者 : のらら / テスター : ゆにたりー卿 DeltaStruct Andrew8128 kazuppa 👑 loop0919 bolero elphe Rice_tawara459 よには yimiya(いみや)
お気に入りにしたユーザー ProblemId : 12032 / 自分の提出
問題文最終更新日: 2025-09-06 11:59:14
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
第2回 岩井星人アンソロジープログラミングコンテスト Div.2 (順位表) の他の問題:

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

  • $1 \leq H, W \leq 200$
  • $H, W$ are integers
  • $S_i$ is a string of length $W$ consisting of the $6$-character substrings yiwiy9, 9yiwiy and .
  • The yiwiy9 and 9yiwiy representing each Iwai Seijin are placed without overlapping each other
  • Input

    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もしくは右上の雲マークをクリックしてアカウントを作成してください。