DWITE Online Computer Programming Contest
January 2009
Problem 2
Tic Tac Win

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

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

The output file OUT2.txt will have 5 lines, a single character (X, O, or period (.)) denoting 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