#P378. 练65.1 水洼个数
练65.1 水洼个数
Description
There is a piece of land of size . After the rain, water has accumulated in some places, marked as 'W', while dry land is marked as '.'. Water that is 8-connected is considered to be part of the same puddle. Find the total number of puddles in the yard.
Input Format
The first line contains and (). The following lines show the land map.
Output Format
A single line containing the total number of puddles.
Sample
10 12
W........WW.
.WWW.....WWW
....WW...WW.
.........WW.
.........W..
..W......W..
.W.W.....WW.
W.W.W.....W.
.W.W......W.
..W.......W.3
Related
In following homework: