提示: 欢迎访问OurACM平台。
Problem 1727 BG Square I

Accept: 133    Submit: 311
Time Limit: 1000 mSec    Memory Limit : 32768 KB

Problem Description

In the big playground,there are many boys and girls,they just form a N*N square.
A so-called "BG Square" is a square in which all boys are separated by girls and vice versa,ignoring the people outside.
Now wzc is wondering what is the biggest size of "BG Square" that you can find in the playground.

Input

There are multiple test cases.
For each case, the first line is a integers N (1<= N <= 1000),indicating there is a N*N square,
which is made of boys and girls in the playground.
Followed by N lines,each line contains N char of 'B' or 'G'.
'B' stands for boy,and 'G' for girl.

Output

For each test case, output the biggest size of "BG Square" that you can find in the playground.

Sample Input

1 B 2 BG GB 4 BGBB GBGB BGBG GBBG 5 BGBGB GBGBG BGBGB GBGBG BGBGB

Sample Output

1 2 3 5

Source

FZU 2009 Summer Training Qualification -- Hero Revival 2

Submit  Back  Status  Discuss