DWITE '08 R4 #2 - Tic Tac Win

View as PDF

Submit solution

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

Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) Problem Resource: DWITE


Comments

There are no comments at the moment.