Tic-tac-toe

In the tic-tac-toe game, two players compete to be the first to place in
a board 3 × 3 three pieces forming a vertical, horizontal or diagonal
line. A player places white pieces, the other one uses black pieces
always taking turns. Starts the player with the white pieces. The game
ends when one of the payers reach to place three pieces forming a line,
or when the nine positions are taken.

Your task is to write a program that indicates if a given configurations
of a tic-tac-toe game is correct or not. That is, it must indicate if
the configuration could be obtained in a game playing according to the
rules.

Input

The input consists of three line with three chacteres each one. A ’W’
indicates a white piece. A ’B’ indicates a black piece. A dot indicates
an empty position.

Output

Your program must print "possible" or "impossible" as required.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T11:18:20.537Z

© Jutge.org, 2006–2026.
https://jutge.org
