|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||41||26||26||66.667%|
Lagno (also known as Reversi and Othello) is a board game for two players, one black and one white. The board is square, consisting of 8 rows and 8 columns.
In one move, the black player places a black piece into an empty square so that, in at least one of eight directions (up, down, left, right and the four diagonal directions), there is a row of white pieces between the newly placed piece and some other black piece. After placing, all white pieces between (in any direction) the newly placed black piece and pre-existing black pieces become black.
Write a program that, for a given board layout, calculates the largest number of white pieces the black player can convert in one move.
The input contains eight lines, each consisting of exactly eight characters '.', 'B' or 'W'. The character '.' represents an empty square, the letter 'B' a square with a black piece, and the letter 'W' a square with a white piece.
Output the largest number of white pieces that black can convert in a single move. If there are no legal moves, output 0.
........ ........ ...BB... ...B.... ..BBW... ..WWW... ....WB.. ........