Tic-Tac-Toe Check

Given a 3x3 tic-tac-toe board represented as an array of 3 strings, each string consisting of 3 characters from {'X', 'O', ' '} (empty), determine whether the board state is reachable in a valid game.

The rules of tic-tac-toe: Players alternate placing their marks, with 'X' going first. A player wins by placing three of their marks in a horizontal, vertical, or diagonal row. If a player wins, the game ends immediately.

Return true if the board state could be reached by playing a valid tic-tac-toe game, and false otherwise.

Examples
Input: ["XOX","X O","O "]
Output: false
Hints

Tic-Tac-Toe Check

Given a 3x3 tic-tac-toe board represented as an array of 3 strings, each string consisting of 3 characters from {'X', 'O', ' '} (empty), determine whether the board state is reachable in a valid game.