func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1005;   char g[N][N];   int l[N][N], r[N][N], up[N][N], dn[N][N];   int jx[N][N], jy[N][N];   struct Node {     int x, y, len;   };   vector<Node> p;   int main() {     int n, m;     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; i++) scanf( %s , g[i] + 1);     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++)         if (g[i][j] ==  * ) {           l[i][j] = l[i][j - 1] + 1;           up[i][j] = up[i - 1][j] + 1;         }     for (int i = n; i >= 1; i--)       for (int j = m; j >= 1; j--)         if (g[i][j] ==  * ) {           r[i][j] = r[i][j + 1] + 1;           dn[i][j] = dn[i + 1][j] + 1;         }     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++)         if (g[i][j] ==  * ) {           int len = min(min(l[i][j], r[i][j]), min(up[i][j], dn[i][j]));           if (len > 1) {             Node temp;             temp = (Node){i, j, len - 1};             p.push_back(temp);             jx[i - len + 1][j]++, jx[i + len][j]--;             jy[i][j - len + 1]++, jy[i][j + len]--;           }         }     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++)         jx[i][j] += jx[i - 1][j], jy[i][j] += jy[i][j - 1];     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++)         if (g[i][j] ==  *  && !jx[i][j] && !jy[i][j]) {           printf( -1 n );           return 0;         }     printf( %d n , (int)p.size());     for (int i = 0; i < p.size(); i++)       printf( %d %d %d n , p[i].x, p[i].y, p[i].len);     return 0;   }   