IntermediateRating 1300
Count the Islands
Count islands of # (connected up, down, left, right) in a grid of # and . .
Input
r c, then r lines.
Output
A count.
Sample 1
Input
4 5 ##..# #...# ..#.. ....#
Output
4
Sample 2
Input
1 1 .
Output
0
Output appears here