#C8008. Largest Asterisk Square

    ID: 51943 Type: Default 1000ms 256MiB

Largest Asterisk Square

Largest Asterisk Square

You are given a rectangular grid with n rows and m columns consisting of characters. Each cell in the grid contains either an asterisk ('*') or a dot ('.'). Your task is to determine the side length of the largest square sub-grid that is composed entirely of asterisks.

The problem can be interpreted using the following formula in LaTeX:

\( dp[i][j] = \min\{dp[i-1][j],\; dp[i][j-1],\; dp[i-1][j-1]\} + 1 \) if the cell at \((i,j)\) is an asterisk, and 0 otherwise.

If no asterisk exists in the grid, the result is 0.

Read the input from standard input and output the result to standard output.

inputFormat

The first line contains two integers n and m (\(1 \leq n, m \leq 1000\)), representing the number of rows and columns respectively. The following n lines each contain a string of length m representing a row of the grid. Each character is either '*' or '.'.

outputFormat

Output a single integer, the side length of the largest square sub-grid composed entirely of '*' characters.

## sample
1 4
****
1

</p>