374. Area of the Largest Island
A grid of 0 and 1 characters is given, with the same connection rule as
problem 372: cells joined up, down, left or right, never diagonally.
Print the number of cells in the largest island. If there is no land at all, print 0.
This is problem 367 on a grid, in the same way that problem 372 was problem 363 on a grid. Count cells as you claim them, keep the maximum across all the starting points, and the shape of the code does not change.
Constraints - `1 ≤ r ≤ 1000` - `1 ≤ c ≤ 1000` - Every character is `0` or `1`.
Input
The first line contains two integers r and c, the number of rows and
columns. Each of the next r lines contains c characters, each 0 or 1,
with no spaces between them.
Output
Print one integer, the size of the largest island, or 0 if there is none.
Hints
Four rungs, in order. The last two open once you have submitted an attempt. A wrong one counts.