Limits 1s, 512 MB

Did you know that certain crops cannot grow next to each other? Given the layout of a field as a grid, determine which spots are safe for new crops.

The layout of a field will be given as rows of asterisks (indicating a spot occupied by an incompatible crop) and dots (indicating a free spot).

.**...
*.....
....**

A free spot is safe only if the 4 adjacent spots (the spots immediately above, below, left, and right) are not occupied by an incompatible crop.

In the example above, there are 5 safe spots:

.**.XX
*..X..
.XX.**

Input

The input will contain two integers RR (0<R<250 < R < 25) and CC (0<C<250 < C < 25).

This will be followed by RR lines, each with CC characters.

Output

Print the number of free spots.

Sample

InputOutput
6 6
****..
*****.
..*.**
.*...*
.*.**.
..**..
3

Submit

Login to submit.

Statistics

90% Solution Ratio
ashik_jiddneyEarliest, Nov '18
ashik_jiddneyFastest, 0.0s
SabbirsLightest, 0 B
saitotaShortest, 62B
Toph uses cookies. By continuing you agree to our Cookie Policy.