시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB28115813154.357%

문제

We want to create a program to check the result of a tic tac toe game. A tic tac toe board is a 3x3 grid. Each position can contain either X or O. The game finishes with a winner when a player creates a straight line of 3 equal symbols. The next 3 boards show finished games with a winner. The empty positions are represented using dots. 

X.X     OX.    .X.
OOO     .O.    .X.
...     X.O    .XO

In contrast, these 3 boards have not finished with a winner.

OXO    X..    ...
XXO    O.O    .X.
OOX    .XX    ..O

입력

The test case consists of 3 lines. Each one with 3 characters (dot, O or X). Note that we are using the letter “O” not the digit zero.

출력

For each test case, write YES if the board finished with a winner or NO if there is no winner.

예제 입력 1

XXX
.OO
OO.

예제 출력 1

YES

예제 입력 2

XOX
OXO
OXO

예제 출력 2

NO

출처

Olympiad > All-Ireland Programming Olympiad > 2015 AIPO National Finals - Junior 1번