#t450. 数水洼
数水洼
Puddles
Problem Description
There is a plot of land of size . After rain it has pools of water: W marks water and . marks dry ground. Two water cells that are 8-connected are considered part of the same puddle. Count the number of puddles in the yard.
Input Format
The first line contains ().
The next lines give the land map.
Output Format
One line: the number of puddles.
Sample Input
10 12
W........WW.
.WWW.....WWW
....WW...WW.
.........WW.
.........W..
..W......W..
.W.W.....WW.
W.W.W.....W.
.W.W......W.
..W.......W.
Sample Output
3
Limitation
1 s, 1024 KiB for each test case.