#K75707. Tic Tac Toe Winner

    ID: 34479 Type: Default 1000ms 256MiB

Tic Tac Toe Winner

Tic Tac Toe Winner

You are given a 3 × 3 Tic Tac Toe board where each cell is marked with 'X', 'O', or a dot ('.') representing an empty cell. Two players take turns placing their mark on the board. A player wins if they manage to place three of their marks in a horizontal, vertical, or diagonal line. Your task is to determine the winner of the game. If no player has won, output Draw.

The board is provided via standard input, where each of the 3 lines contains exactly 3 tokens separated by spaces. A token is either X, O, or a dot (.) representing an empty cell.

Note: In the provided input, a dot ('.') should be interpreted as an empty cell.

inputFormat

The input consists of 3 lines read from standard input. Each line contains 3 tokens separated by a space. Each token is either X, O, or . (a dot) representing an empty cell.

Example Input:

X X X
O O .
. . .

outputFormat

The output is a single line printed to standard output. It should be either X if player X wins, O if player O wins, or Draw if neither player has won.

Example Output:

X
## sample
X X X
O O .
. . .
X