1 #include<cstdio>
2 #include<iostream>
3 #include<cstring>
4
5 using namespace std;
6
7 int n, m, ans;
8 int dir[8][2] = {{-1, 0}, {-1, -1}, {-1, 1}, {0, 1}, {0, -1}, {1, 1}, {1, 0}, {1, -1}};
9 char g[105][105];
10
11 inline void dfs(int x, int y){
12 for(int i = 0; i < 8; i++){
13 int nx = x + dir[i][0];
14 int ny = y + dir[i][1];
15 if(nx > 0 && ny > 0 && nx <= n && ny <= m && g[nx][ny] == '@'){
16 g[x][y] = '*';
17 g[nx][ny] = '*';
18 dfs(nx, ny);
19 }
20 }
21 }
22
23 int main(){
24 while(~scanf("%d%d", &n, &m) && n + m != 0){
25 ans = 0;
26 for(int i = 1; i <= n; i++){
27 for(int j = 1; j <= m; j++){
28 cin >> g[i][j];
29 }
30 }
31 for(int i = 1; i <= n; i++){
32 for(int j = 1; j <= m; j++){
33 if(g[i][j] == '@'){
34 ans++;
35 dfs(i, j);
36 }
37 }
38 }
39 printf("%d
", ans);
40 }
41 return 0;
42 }