No.1941 CHECKER×CHECKER(1)
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. Show the original
Problem Statement
There is a grid with $3$ rows and $3$ columns. The cell at the $i$-th row from the top and the $j$-th column from the left is called cell $(i,j)$.
Each cell is colored either black or white.
The color information of the cells is given as strings $S_1$, $S_2$, $S_3$ in the following format.
- If the $j$-th character of the string $S_i$ is
#, cell $(i,j)$ is black. - If the $j$-th character of the string $S_i$ is
., cell $(i,j)$ is white.
The grid is said to be a checkered pattern if, for every cell, the cells adjacent to it by an edge have a color different from that of the cell itself.
Determine whether the given grid is a checkered pattern.
Input
The input is given from standard input in the following format.$S_1$ $S_2$ $S_3$
Constraints
$S_1$, $S_2$, $S_3$ are strings of $3$ characters consisting of# or .
Output
Print Yes if the grid is a checkered pattern, and No otherwise.
Sample
Sample 1
Input
#.# .#. #.#
Output
Yes
For every cell, the cells adjacent to it by an edge have a color different from that of the cell itself, so the answer is Yes.
Sample 2
Input
### #.# ###
Output
No
For the center cell, the cells adjacent to it by an edge have a color different from that of the cell itself.
However, the other cells do not satisfy the condition, so the answer is No.
Sample 3
Input
#.# #.# .#.
Output
No
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
H20
蜜蜂
naskya