IntermediateAlgorithms25 points

Satellite map: islands left by the flood

After a monsoon flood in Dhaka, a satellite image is converted into a grid. A cell marked # is dry land and a cell marked . is water. Rescue teams treat land cells that touch up, down, left or right as one connected island (diagonal neighbours are not connected). They want to know how many islands there are and how big the largest one is, to decide where to drop supplies.

Task: the first line holds R and C (1 ≤ R, C ≤ 40). The next R lines each hold exactly C characters, # or .. Print two integers separated by a space: the number of islands and the number of cells of the largest island. If there is no land, print 0 0.

Sample test

Input

4 5
##..#
#...#
..#..
#..##

Expected output

5 3

Your answer is also checked against 5 hidden tests.