- Go and Oreo 围棋问题
Asa likes Go and Oreo, and he wants to combine them.
One day when he was playing Go, he suddenly came out with an idea: he could try to construct as more Oreo Patterns as possible!
An Oreo Pattern is a horizontal or vertical pattern with a starting black piece, an ending black piece, and consecutive white pieces in between.
Please help him fill the board with pieces to achieve his goal, and tell him the number of solutions by the way.
The first line is an integer , indicating the number of test cases.
For each test case:
The first line is the size of the Go board .
Then lines follows. Each line contains characters, indicating the Go board. Character '.', 'B' and 'W' indicate an empty position, a black piece and a white piece respectively.
The pieces do not necessarily follow the rules of Go.
For each test case, output the maximum number of Oreo Patterns as well as the number of solutions separated by a white space in one line.