// 2004‘“à—\‘IB Red and Black #include #include #include using namespace std; int dx[] = {0, 1, 0, -1}; int dy[] = {1, 0, -1, 0}; int main(){ int w, h; string b[20]; while(cin >> w >> h, w){ for(int i=0;i> b[i]; int sx, sy; for(int i=0;i > qu; qu.push(make_pair(sx,sy)); int res = 0; while(!qu.empty()){ pair pr = qu.front(); qu.pop(); int x = pr.first, y = pr.second; res++; for(int i=0;i<4;i++){ int nx = x+dx[i], ny = y+dy[i]; if(nx<0||h<=nx||ny<0||w<=ny||b[nx][ny]!='.') continue; b[nx][ny] = '#'; qu.push(make_pair(nx,ny)); } } cout << res << endl; } }