#P1917. 三子棋II

三子棋II

Description

xiaoa and uim like to practice Tic-Tac-Toe with each other. Everyone has played Tic-Tac-Toe, right? It is played on a 3×3 grid with OOXX\verb!OOXX! (don't get the wrong idea), and whoever gets 33 in a row wins.

Although xiaoa tries hard to record the games, he still cannot beat uim.

Since xiaoa is a bit slow, uim always lets him move first. xiaoa’s first move is always the center.

This time, xiaoa wants to use a tactic. The game has just started, with fewer than 33 pieces on the board. xiaoa wants to know, given the current position, whether he has a forced win (that is, if he plays optimally, he will win no matter how the opponent plays).

Input Format

Three lines representing the board, where O\verb!O! denotes xiaoa, X\verb!X! denotes uim, and -\verb!-! denotes an empty cell. It is guaranteed that the number of pieces does not exceed 33.

Output Format

Two lines.

On the first line, if xiaoa will win, output xiaoa will win.. If xiaoa will lose, output uim will win.. If it is unknown, output Dont know..

On the second line, output the number of pieces that have already been placed on the board.

---
-O-
---
Dont know.
1

---
-O-
-XO
xiaoa will win.
3

Hint

Translated by ChatGPT 5