시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB67494572.581%

문제

After years of planning, you're finally ready to host the Tic-Tac-Toe world championships. Everything had been going great until you made a terrible discovery: the judges, who determine which player has won the game, have been taking bribes! There's not enough time to train new ones, so you opt for a backup plan: you'll create a piece of code that analyzes the board and tells the players if anyone has won.

A Tic-Tac-Toe board looks like the following. Every square can be empty, filled with an X, or filled with a O (capital letter 'o').

Player X has won if they have three X's in a row. Player O wins if they can do the same with the O's. A row can be horizontal, vertical, or diagonal.

Can you write the new judging code and salvage the competition?

입력

The input consists of three lines each with $3$ characters. Each line represents a row on the board. Each character in a line represents a column. This means you have $3$ rows and $3$ columns just like a normal Tic-Tac-Toe board.

Each square in the board contains either an X, O (that's a capital letter, not a number), or E. X and O represent markings made by the players while E represents an empty square.

출력

If player X has won, you should print out the character X. If player O has won, you should print out the character O. If neither player has won, you should print out the character N.

예제 입력 1

XEO
EXO
EOX

예제 출력 1

X

예제 입력 2

OXO
OXX
XOX

예제 출력 2

N

예제 입력 3

XXE
EEX
OOO

예제 출력 3

O

출처

School > CS@Mines > CS@Mines HSPC 2021 I번

  • 문제를 만든 사람: Jack Garner