Copper Islands on a PCB
A PCB is scanned as a grid: # is copper, . is bare board. Copper cells touching up, down, left or right belong to the same island. How many separate copper islands are there?
Input
and , then lines of characters.
Output
The number of islands.
Constraints
Sample 1
Input
4 5 ##... ##... ..#.. ...##
Output
3