LearnPy Hub
← Arena
IntermediateRating 1300

Land You Can't Walk Off

Count the land cells (#) from which you cannot walk off the edge of the grid, moving up, down, left and right over land.

Input

r and c, then r rows.

Output

One integer.

Sample 1

Input
4 4
....
#.#.
.##.
....
Output
3

Sample 2

Input
3 3
###
###
###
Output
0
solution.py
Output appears here
Land You Can't Walk Off · Python Arena problem · LearnPy Hub