func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 600;   char graph[MAXN][MAXN];   int dx[4] = {-1, 0, 0, 1};   int dy[4] = {0, -1, 1, 0};   vector<char> op;   vector<pair<int, int> > pos;   bool visited[MAXN][MAXN];   void solve(int x, int y, int n, int m, int initX, int initY) {     visited[x][y] = true;     bool flag = false;     for (int i = 0; i < 4; i++) {       int nx = x + dx[i];       int ny = y + dy[i];       if (nx >= 0 && nx < n && ny >= 0 && ny < m && graph[nx][ny] ==  .  &&           !visited[nx][ny]) {         if (!flag) {           op.push_back( B );           pos.push_back(make_pair(x + 1, y + 1));         }         flag = true;         solve(nx, ny, n, m, initX, initY);       }     }     if (!flag) {       if (x == initX && y == initY) {         op.push_back( B );       } else {         op.push_back( R );       }       pos.push_back(make_pair(x + 1, y + 1));     } else {       if (!(x == initX && y == initY)) {         op.push_back( D );         pos.push_back(make_pair(x + 1, y + 1));         op.push_back( R );         pos.push_back(make_pair(x + 1, y + 1));       }     }   }   int main() {     int n, m;     scanf( %d%d , &n, &m);     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         cin >> graph[i][j];       }     }     memset(visited, false, sizeof(visited));     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         if (graph[i][j] ==  .  && !visited[i][j]) {           solve(i, j, n, m, i, j);         }       }     }     int size = op.size();     printf( %d n , size);     for (int i = 0; i < size; i++) {       printf( %c %d %d n , op[i], pos[i].first, pos[i].second);     }     return 0;   }   