#P377. 【例65.3】 细胞个数

【例65.3】 细胞个数

Description

A rectangular array is composed of digits 00 to 99. Digits 11 to 99 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 nn (1n1001\leq n\leq 100) and columns mm (1m1001\leq m\leq 100).
The following lines contain an n×mn \times m matrix.

Output Format

The number of cells.

Sample

4 10
0234500067
1034560500
2045600671
0000000089
4