Type: Default 1000ms 256MiB

八连块

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Description

输入一个m行n列的字符矩阵,统计字符“@”组成多少个八连块。如果两个字符“@”所在的格子相邻(横竖或者对角线方向),就说它们属于同一个八连块。例如,下图中有两个八连块。

Input Format

第一行包括两个正整数m和n,由空格隔开,接下来的m行,每行n个字符,字符只包括“*”和“@”。

Output Format

一个自然数,表示八连块的个数。

5 5
****@
*@@*@
*@**@
@@@*@
@@**@
2

Hint

数据范围:0<m,n<101