func_code_string: #include <bits/stdc++.h>   using namespace std;   char save[550][550];   int n, m;   bool vis[550][550];   int dir[4][2] = {-1, 0, 0, 1, 1, 0, 0, -1};   int ans;   bool iscan(int x, int y) {     if (x < 1 || x > n || y < 1 || y > m) return false;     return true;   }   struct Rec {     char k;     int x, y;   } rec[1100000];   void dfs(int x, int y) {     int xx, yy;     for (int i = 0; i < 4; i++) {       xx = x + dir[i][0], yy = y + dir[i][1];       if (iscan(xx, yy)) {         if (save[xx][yy] !=  . ) continue;         if (vis[xx][yy]) continue;         vis[xx][yy] = true;         ans++;         rec[ans].k =  B , rec[ans].x = xx, rec[ans].y = yy;         dfs(xx, yy);         ans++;         rec[ans].k =  D , rec[ans].x = xx, rec[ans].y = yy;         ans++;         rec[ans].k =  R , rec[ans].x = xx, rec[ans].y = yy;       }     }   }   int main() {     while (scanf( %d%d , &n, &m) != EOF) {       for (int i = 1; i <= n; i++) scanf( %s , save[i] + 1);       memset(vis, false, sizeof(vis));       ans = 0;       for (int i = 1; i <= n; i++)         for (int j = 1; j <= m; j++) {           if (save[i][j] ==  .  && !vis[i][j]) {             vis[i][j] = true;             ans++;             rec[ans].k =  B , rec[ans].x = i, rec[ans].y = j;             dfs(i, j);           }         }       printf( %d n , ans);       for (int i = 1; i <= ans; i++)         printf( %c %d %d n , rec[i].k, rec[i].x, rec[i].y);     }     return 0;   }   