A. 练65.1 水洼个数

    Type: Default 1000ms 64MiB

练65.1 水洼个数

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

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

20251122 C班作业(7)

Not Claimed
Status
Done
Problem
2
Open Since
2025-11-22 0:00
Deadline
2025-11-30 23:59
Extension
24 hour(s)