细胞

Grade 0 Open Time Thursday, 21 February 2013, 11:02 pm
Discount 0.8 Time Discount Thursday, 28 February 2013, 11:02 pm
Allow late Yes Close Time Thursday, 28 February 2013, 11:02 pm
Input file cellnum.in Output file cellnum.out

细胞

一矩形阵列由数字0到9组成,数字1到9代表细胞,细胞的定义为沿细胞数字上下左右还是细胞数字则为同一细胞,求给定矩形阵列的细胞个数。如阵列:
0234500067
1034560500
2045600671
0000000089
有4个细胞。
输入:整数m,n(m行,n列 (0<m,n<=100))
矩阵
输出:细胞的个数。
 

样例:
输入(cellnum.in):
4  10
0234500067
1034560500
2045600671
0000000089

输出(cellnum.out):
4