You will be given an grid of asterisks () and dots (). The grid is the top-left view of an infinitely repeating pattern of diamonds. And, it is guaranteed that at least one asterisk will be present on the grid given to you.
The size of a diamond is defined by an integer .
When ,
*
When ,
.*.
***
.*.
When ,
..*..
.***.
*****
.***.
..*..
When ,
...*...
..***..
.*****.
*******
.*****.
..***..
...*...
And, so on.
Given such a grid you have the determine the for the diamond.
The input will start with two integers and ().
The following lines will contain characters each (either asterisks or dots), representing the grid.
Print the size of the diamond in the pattern in the grid as defined in the problem statement.
Input | Output |
---|---|
10 10 ..*....*.. .***..***. ********** .***..***. ..*....*.. ..*....*.. .***..***. ********** .***..***. ..*....*.. | 3 |