Problem2841--细胞

2841: 细胞

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 0  Solved: 0
[Status] [Submit] [Creator:]

Description

一个矩阵阵列由数字0到9组成。
其中数字1到9代表细胞,细胞的定义为沿细胞数字上下左右还是细胞数字则为同一细胞,求给定矩形阵列的细胞个数.
例如:如下阵列
4 10
0234500067
1034560500
2045600671
0000000089
有4个细胞

Input

第一行为矩阵的行n和列m。1≤n,m≤20
下面为一个n*m的矩阵

Output

细胞个数

Sample Input Copy

4 10
0234500067
1034560500
2045600671
0000000089

Sample Output Copy

4

Source/Category

DFS YBT level5