#include <bits/stdc++.h>
using namespace std;
const int maxN = 505;
struct output {
  char ch;
  int x, y;
  output(char c, int a, int b) {
    ch = c;
    x = a;
    y = b;
  }
  void out() { cout << ch << " " << x << " " << y << endl; }
};
string s;
int a[maxN][maxN], ans1, sum;
bool mark[maxN][maxN];
vector<output> ans;
vector<pair<int, int> > v[maxN][maxN];
pair<int, int> parent[maxN][maxN];
void dfs(int x, int y) {
  mark[x][y] = 1;
  ans.push_back(output('B', x, y));
  for (int i = 0; i < v[x][y].size(); i++) {
    pair<int, int> e = v[x][y][i];
    if (mark[e.first][e.second] == 0) {
      parent[e.first][e.second] = make_pair(x, y);
      dfs(e.first, e.second);
    }
  }
  if (parent[x][y] != make_pair(x, y)) {
    ans.push_back(output('D', x, y));
    ans.push_back(output('R', x, y));
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> s;
    for (int j = 1; j <= m; j++) a[i][j] = (s[j - 1] == '.' ? 0 : 1);
  }
  for (int i = 0; i <= m + 1; i++) a[0][i] = a[n + 1][i] = 1;
  for (int i = 0; i <= n + 1; i++) a[i][0] = a[i][m + 1] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (mark[i][j] == 0) {
        if (a[i - 1][j] == 0) v[i][j].push_back(make_pair(i - 1, j));
        if (a[i + 1][j] == 0) v[i][j].push_back(make_pair(i + 1, j));
        if (a[i][j - 1] == 0) v[i][j].push_back(make_pair(i, j - 1));
        if (a[i][j + 1] == 0) v[i][j].push_back(make_pair(i, j + 1));
      }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (mark[i][j] == 0 && a[i][j] == 0) {
        sum = 0;
        parent[i][j] = make_pair(i, j);
        dfs(i, j);
      }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) ans[i].out();
  return 0;
}
