Problem A
Eight Queens
In the game of chess, the queen is a powerful piece. It can attack by moving any number of spaces in its current row, in its column or diagonally.
In the eight queens puzzle, eight queens must be placed on a
standard
![\includegraphics[width=0.7\textwidth ]{chess}](/problems/8queens/file/statement/en/img-0001.png)
Input
Input will contain a description of a single chess board, given as eight lines of eight characters each. Input lines will consist of only the characters ‘.’ and ‘*’. The ‘.’ character represents an empty space on the board, and the ‘*’ character represents a queen.
Output
Print a single line of output. Print the word “valid” if the given chess board is a valid solution to the eight queens problem. Otherwise, print “invalid”.
Sample Input 1 | Sample Output 1 |
---|---|
*....... ..*..... ....*... ......*. .*...... .......* .....*.. ...*.... |
invalid |
Sample Input 2 | Sample Output 2 |
---|---|
*....... ......*. ....*... .......* .*...... ...*.... .....*.. ..*..... |
valid |