#P378. 练65.1 水洼个数

练65.1 水洼个数

Description

There is a piece of land of size N×MN \times M. 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 NN and MM (1N,M1001\leq N, M \leq 100). The following lines show the N×MN \times M 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