A satellite map is a grid of land (#) and water (.). An island is a group of land cells connected horizontally or vertically. Write Islands: read rows cols and the rows of the map, then scan the grid row by row; each time you meet an unvisited land cell, a recursive method flood(r, c) must visit the whole island (down, up, right, left), mark its cells as visited by turning them into water, and return its size.
Print the number of land cells, the number of islands, their sizes in order of discovery and the largest size.
For the input
4 6
##..#.
#...#.
..#...
.###.#
the program prints
Land cells: 10
Islands: 4
Sizes in order of discovery: 3 2 4 1
Largest island: 4