// // 気合で // #include using namespace std; typedef unsigned int uint; typedef long long int ll; typedef unsigned long long int ull; #define debugv(v) printf("L%d %s => ",__LINE__,#v);for(auto e:v){cout< ",__LINE__,#m);for(int x=0;x<(w);x++){cout<<(m)[x]<<" ";}cout<(t).count()) template ostream& operator <<(ostream &o,const pair p){o<<"("<>height>>width; for (i=1;i<=height;i++){ cin >> &data[i][1]; } for (y=0;y<=height+1;y++) for (x=0;x<=width+1;x++) if (data[y][x]!='w' && data[y][x]!='b') data[y][x]='.'; // debugaa(data,height+2,width+2) int score = 0; int flg=1; while(flg){ flg=0; for (y=height;0<=y;y--){ for (x=1;x<=width;x++){ if (data[y][x]=='.') continue; k=(data[y-1][x]!='.')+(data[y+1][x]!='.')+(data[y][x-1]!='.')+(data[y][x+1]!='.'); if (k==1){ flg=1; score+=100; data[y][x]='.'; data[y-1][x]=data[y+1][x]=data[y][x-1]=data[y][x+1]='.'; }else if (!flg && 1