#include <bits/stdc++.h>
using namespace std;
char str[505][505];
int ans;
struct node {
  int x;
  int y;
  char op;
} p, tmp;
queue<node> que, s;
stack<node> s_tmp;
int dir[4][2] = {1, 0, -1, 0, 0, 1, 0, -1};
int n, m;
bool check(int x, int y) {
  if (x < 1 || x > n || y < 1 || y > m) return false;
  if (str[x][y] == 'B') return true;
  return false;
}
void bfs() {
  while (que.size()) {
    tmp = que.front();
    que.pop();
    s_tmp.push(tmp);
    for (int i = 0; i < 4; i++) {
      int tx = tmp.x + dir[i][0];
      int ty = tmp.y + dir[i][1];
      if (tx >= 1 && tx <= n && ty >= 1 && ty <= m && str[tx][ty] == 'B') {
        p.x = tx;
        p.y = ty;
        que.push(p);
        str[tx][ty] = 'R';
      }
    }
  }
}
int main() {
  while (~scanf("%d%d", &n, &m)) {
    for (int i = 1; i <= n; i++) scanf("%s", str[i] + 1);
    ans = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        if (str[i][j] == '.') {
          str[i][j] = 'B';
          p.op = 'B';
          p.x = i;
          p.y = j;
          s.push(p);
          ans++;
        } else if (str[i][j] == 'R') {
          str[i][j] = 'B';
          p.op = 'D';
          p.x = i;
          p.y = j;
          s.push(p);
          p.op = 'B';
          p.x = i;
          p.y = j;
          s.push(p);
          ans += 2;
        }
      }
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        if (str[i][j] == 'B') {
          p.x = i;
          p.y = j;
          str[i][j] = 'R';
          que.push(p);
          bfs();
          while (s_tmp.size() > 1) {
            p = s_tmp.top();
            p.op = 'D';
            s.push(p);
            p.op = 'R';
            s.push(p);
            s_tmp.pop();
            ans += 2;
          }
          s_tmp.pop();
        }
      }
    }
    printf("%d\n", ans);
    int c = 0;
    while (s.size()) {
      tmp = s.front();
      s.pop();
      printf("%c %d %d\n", tmp.op, tmp.x, tmp.y);
      str[tmp.x][tmp.y] = tmp.op;
    }
  }
  return 0;
}
