You are given a grid of rows rows and cols columns where each cell is either O (open) or X (blocked). Consider the 4-connected regions of O cells. A region is sealed if none of its cells lies on the outer border of the grid.
Count how many O cells belong to sealed regions (i.e. cells that cannot reach the border through open cells).
Input format
Line 1: two integers rows and cols.
The next rows lines each contain a string of exactly cols characters, each O or X.
Output format
A single integer: the number of O cells in sealed regions.
Constraints
- 1 <= rows, cols <= 50
- Every grid character is
OorX.