#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
using namespace std;
char tab[510][510];
int main(){
int n;
for(;;){
scanf("%d", &n);
if(!n) break;
for(int lx = 0; lx < n;lx++)
scanf("%s", tab[lx]);
int dx[4] = {1, 1, 1, 0};
int dy[4] = {-1, 0, 1, 1};
int pts[3] = {0};
for(int lx = 0;lx < n;lx++){
for(int ly = 0;ly < n;ly++){
char ch = tab[lx][ly];
if(ch == '.') continue;
for(int ld = 0;ld < 4;ld++){
bool ok = true;
for(int len = -1;len <= 5 and ok;len++){
int nx = lx+len*dx[ld], ny = ly+len*dy[ld];
bool fg = true;
if(nx < 0 or nx >= n or ny < 0 or ny >= n or tab[nx][ny] != ch){
fg = false;
}
ok = fg^(len == -1 or len == 5);
}
if(ok)
pts[ch-'A']++;
}
}
}
printf("A %d\nB %d\nC %d\n\n", pts[0], pts[1], pts[2]);
}
return 0;
}
沒有留言:
張貼留言