You are given a board of size M × N where each cell can be either empty ('O') or a wall ('X').
A robot is initially placed at the top-left cell (0,0) and can move in four directions: up, down, left, and right — but not diagonally.
The robot can only move through empty cells and cannot pass through or land on walls.
Your task is to print the maximum number of empty cells the robot can visit starting from the top-left cell, including the starting cell.
Input Format:
- First line: Two integers M and N — the number of rows and columns of the board.
- Next M lines: Each contains a string of length N, consisting of characters 'O' and 'X'.
Output Format:
- A single integer — the number of empty cells the robot can visit.
Constraints:
- 1 ≤ M, N ≤ 100
Sample Input 1:
4 3
OXO
OOX
XOO
OOO
Sample Output 1:
8
Explanation:
Starting at (0,0), the robot can move through a connected component of 8 'O' cells. One cell ('O' at (0,2)) is isolated and cannot be reached.
Sample Input 2:
4 3
000
00X
OXO
X00
Sample Output 2:
6
Explanation:
Starting at (0,0), the robot can visit 6 cells before being blocked by walls.