#t447. 细胞
细胞
Cells
Problem Background
Special for beginners, ^_^
Problem Description
A rectangular array consists of digits to . Digits to represent cells. A cell is defined as: if the digit adjacent (up, down, left, right) to a cell digit is also a cell digit, they belong to the same cell. Find the number of cells in the given rectangular array. For example:
The array:
4 10
0234500067
1034560500
2045600671
0000000089
has cells.
Input Format
The first line is the number of rows and columns of the matrix;
The following is an matrix.
Output Format
The number of cells.
Sample Input 1
4 10
0234500067
1034560500
2045600671
0000000089
Sample Output 1
4
Constraints
. Time limit 1s, memory limit 1024KiB for each test case.