## DWITE '08 R4 #2 - Tic Tac Win

View as PDF

Points: 5
Time limit: 2.0s
Memory limit: 64M

Problem type
##### DWITE Online Computer Programming Contest, January 2008, Problem 2

This one is a part of a classic game -- given a 3x3 board, check if X, O, or neither has won (winner being the one having 3 of their symbols in a row, column, or diagonal).

The input will contain 5 sets, 3 lines each. Each line has 3 characters, out of X, O, or period .

The output will have 5 lines, a single character (X, O, or period (.)) -- the winner of the game.

Note: you could assume that there is only one winner on each board.

#### Sample Input

XO.
.XO
O.X
...
.X.
...
XXO
OOX
XOO
OOO
...
...
O..
O..
O..

#### Sample Output

X
.
.
O
O