func_code_string: #include <bits/stdc++.h>   using namespace std;   char ch[60][60];   int x[4] = {-1, 1, 0, 0};   int y[4] = {0, 0, -1, 1};   bool mark[60][60];   void del(int a, int b) {     for (int i = 0; i < 4; i++)       if (mark[a + x[i]][b + y[i]]) {         mark[a + x[i]][b + y[i]] = 0;         del(a + x[i], b + y[i]);       }   }   bool dfs(int a, int b, int n, int m) {     for (int i = 0; i <= n + 1; i++)       for (int j = 0; j <= m + 1; j++)         if (ch[i][j] ==  # )           mark[i][j] = 1;         else           mark[i][j] = 0;     mark[a][b] = 0;     int s = 0;     for (int i = 0; i < 4; i++)       if (mark[a + x[i]][b + y[i]]) {         s++;         if (s > 1) return 1;         mark[a + x[i]][b + y[i]] = 0;         del(a + x[i], b + y[i]);       }     return 0;   }   int main() {     int n, m;     while (scanf( %d %d , &n, &m) != EOF) {       gets(ch[0]);       for (int i = 0; i <= n + 1; i++)         for (int j = 0; j <= m + 1; j++) ch[i][j] =  . ;       for (int i = 1; i <= n; i++) gets(ch[i] + 1);       int s = 0;       for (int i = 1; i <= n; i++)         for (int j = 1; j <= m; j++)           if (ch[i][j] ==  # ) s++;       if (s < 3)         printf( -1 n );       else {         s = 2;         for (int i = 1; i <= n; i++) {           for (int j = 1; j <= m; j++)             if (ch[i][j] ==  # ) {               if (dfs(i, j, n, m)) {                 s = 1;                 break;               }             }           if (s < 2) break;         }         printf( %d n , s);       }     }     return 0;   }   