#P9908. [COCI 2023/2024 #2] Pahuljice
[COCI 2023/2024 #2] Pahuljice
Problem Description
Lana likes drawing snowflakes. A snowflake of size is defined as follows.
- The center of the snowflake is a .
- There are characters above and characters below the .
- There are characters to the left and characters to the right of the .
- There are characters to the upper-left and characters to the lower-right of the .
- There are characters to the lower-left and characters to the upper-right of the .
Snowflakes may overlap. Below are some examples of snowflakes.

The three pictures contain, respectively: one snowflake of size ; two overlapping snowflakes of sizes and ; and one snowflake of size (because a size snowflake is incomplete).
Given an character matrix, find the size of the largest snowflake in it.
Input Format
The first line contains two integers .
The next lines each contain a string of length , describing an matrix. It is guaranteed to contain only $\texttt{'+'}, \texttt{'-'}, \texttt{'|'}, \texttt{'/'}, \texttt{'\textbackslash'}, \texttt{'.'}$.
Output Format
Output one integer: the size of the largest snowflake. If there is none, output .
5 6
\.\|/.
---+--
/./|\.
./.|.\
/..|..
1
7 7
\.|./..
.\|/...
--+--..
./|\...
/.|.\|/
....-+-
..../|\
2
7 7
\|/|\|/
-+-|-+-
/|\|/|\
---+---
\|/|\|/
-+-|-+-
/|\|/|\
1
Hint
Constraints
| Score | Special property | |
|---|---|---|
| The largest snowflake size is , or there is no snowflake at all. | ||
| There is at most one in the matrix. | ||
| None. |
For all testdata, .
Translated by ChatGPT 5