
Lana likes to draw specific snowflakes. A snowflake of size
- The center of the snowflake is the character
+
. - Above and below the character
+
, there is a sequence of characters|
. - To the left and right of the character
+
, there is a sequence of characters-
. - On the diagonal from the upper left corner to the center and from the center
to the lower right corner of the snowflake, there is a sequence of
characters\
. - On the diagonal from the upper right corner to the center and from the center
to the lower left corner of the snowflake, there is a sequence of
characters/
.
Sometimes Lana connects several snowflakes, but even then the size of each snowflake is determined separately, regardless of whether the snowflakes share some characters.
\|/
-+-
/|\
\.|./..
.\|/...
--+--..
./|\...
/.|.\|/
....-+-
..../|\
\.|./.
.\|/..
--+---
./|\..
/...\.
On the left is an example of a snowflake of size
In the middle is an example of connected snowflakes, the left one of size
On the right is an example of a snowflake of size |
to be of size
Lana is currently drawing snowflakes on a piece of paper of size
Can you help Lana determine the size of the largest snowflake in the drawing?
Input Specification
The first line contains two integers
In each of the following
The characters that can appear in the drawing are +
, -
, \
, |
, /
and .
.
The ASCII values of these characters are 43, 45, 92, 124, 47 and 46, respectively.
Output Specification
In the first and only line, you should output the size of the largest snowflake in the drawing.
Constraints
Subtask | Points | Constraints |
---|---|---|
1 | 11 | There won't be any snowflake, or the largest snowflake will be of size |
2 | 11 | There will be at most one character + in the drawing. |
3 | 28 | No additional constraints. |
Sample Input 1
5 6
\.\|/.
---+--
/./|\.
./.|.\
/..|..
Sample Output 1
1
Explanation for Sample 1
Only one snowflake is drawn.
In the directions up-left, up and up-right from the center of the snowflake, there are sequences of length
Therefore, the size of the snowflake is
Sample Input 2
7 7
\.|./..
.\|/...
--+--..
./|\...
/.|.\|/
....-+-
..../|\
Sample Output 2
2
Explanation for Sample 2
Two connected snowflakes are drawn, the left one of size
Sample Input 3
7 7
\|/|\|/
-+-|-+-
/|\|/|\
---+---
\|/|\|/
-+-|-+-
/|\|/|\
Sample Output 3
1
Comments