#P377. 【例65.3】 细胞个数
【例65.3】 细胞个数
Description
A rectangular array is composed of digits to . Digits to represent cells. A cell is defined as a group of adjacent cell digits (up, down, left, or right) that are considered part of the same cell. Find the number of cells in the given rectangular array. For example:
Array:
4 10 0234500067 1034560500 2045600671 0000000089
There are $4$ cells.
Input Format
The first line contains two integers: the number of rows () and columns ().
The following lines contain an matrix.
Output Format
The number of cells.
Sample
4 10
0234500067
1034560500
2045600671
00000000894