Draw the board and find the winner (Tic-Tac-Toe)
Read a tic-tac-toe board: three lines of three characters, X, O or .. Print it like this (spaces around each cell, | between, ---+---+--- between rows), then the status: X wins, O wins, draw (full board, no winner) or in progress. A malformed board prints only invalid board.
Input: Three lines.
Output: The board (5 lines) and the status.
Difficulty: Easy. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.
Hint
- There are 8 winning lines: 3 rows, 3 columns, 2 diagonals. Store them as index triples.