#include <bits/stdc++.h>
using namespace std;
int n, m, poss[12][12], v[7], i, j;
char a[12][12];
int di[4] = {-1, 1, 0, 0}, dj[4] = {0, 0, -1, 1};
void dfs(int x, int y){
poss[x][y] = 1;
for (int t = 0; t < 4; t++) if (x + di[t] > 0 && x + di[t] <= n && y + dj[t] > 0 && y + dj[t] <= m && !poss[x + di[t]][y + dj[t]] && a[x][y] == a[x + di[t]][y + dj[t]]) dfs(x + di[t], y+dj[t]);
}
int check(int i, int j){return a[i][j] == a[x + i][y + j];}
int main(){
cin >> n >> m;
for (i = 1;i <= n; i++) for (j = 1;j <= m;j++) cin >> a[i][j];
for (i = 1;i <= n; i++)
for (j = 1; j <= m; j++)
if (a[i][j] != '.' && !poss[i][j]){
dfs(i,j);
if (check(0,1) && check(1,0) && check(1,1)) v[1]++;
if ((check(0,1) && check(0,2) && check(0,3)) || (check(1,0) && check(2,0) && check(3,0))) v[2]++;
if ((check(0,1) && check(1,0) && check(1,-1)) || (check(1,0) && check(1,1) && check(2,1))) v[3]++;
if ((check(0,1) && check(1,1) && check(1,2)) || (check(1,0) && check(1,-1) && check(2,-1))) v[4]++;
if ((check(1,-1) && check(1,0) && check(1,1)) || (check(1,-1) && check(1,0) && check(2,0)) ||
(check(0,1) && check(0,2) && check(1,1)) || (check(1,0) && check(1,1) && check(2,0))) v[5]++;
}
for (i = 1;i < 6; i++) cout << v[i] << '\n';
}
Compilation message
tetris.cpp: In function 'int check(int, int)':
tetris.cpp:13:45: error: 'x' was not declared in this scope
13 | int check(int i, int j){return a[i][j] == a[x + i][y + j];}
| ^
tetris.cpp:13:52: error: 'y' was not declared in this scope
13 | int check(int i, int j){return a[i][j] == a[x + i][y + j];}
| ^