{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"Due to recent rains, water has pooled in various places in Farmer John\u0027s field, which is represented by a rectangle of N x M (1 \u0026lt;\u003d N \u0026lt;\u003d 100; 1 \u0026lt;\u003d M \u0026lt;\u003d 100) squares. Each square contains either water (\u0027W\u0027) or dry land (\u0027.\u0027). Farmer John would like to figure out how many ponds have formed in his field. A pond is a connected set of squares with water in them, where a square is considered adjacent to all eight of its neighbors.\r\u003cbr\u003e\r\u003cbr\u003eGiven a diagram of Farmer John\u0027s field, determine how many ponds he has."}},{"title":"Input","value":{"format":"HTML","content":"* Line 1: Two space-separated integers: N and M\r\u003cbr\u003e\r\u003cbr\u003e* Lines 2..N+1: M characters per line representing one row of Farmer John\u0027s field. Each character is either \u0027W\u0027 or \u0027.\u0027. The characters do not have spaces between them."}},{"title":"Output","value":{"format":"HTML","content":"* Line 1: The number of ponds in Farmer John\u0027s field."}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e10 12\r\nW........WW.\r\n.WWW.....WWW\r\n....WW...WW.\r\n.........WW.\r\n.........W..\r\n..W......W..\r\n.W.W.....WW.\r\nW.W.W.....W.\r\n.W.W......W.\r\n..W.......W.\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Hint","value":{"format":"HTML","content":"OUTPUT DETAILS:\r\u003cbr\u003e\r\u003cbr\u003eThere are three ponds: one in the upper left, one in the lower left,and one along the right side."}}]}