#include <bits/stdc++.h>
using namespace std;
const int N = 600;
char A[N][N];
vector<pair<char, pair<int, int>>> ans;
int K, n, m, dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};
vector<pair<int, int>> t;
bool mark[N][N];
void read() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> A[i][j];
}
void dfs(int x, int y) {
  t.push_back({x, y});
  mark[x][y] = true;
  for (int u = 0; u < 4; u++)
    if (A[dx[u] + x][dy[u] + y] == '.' && !mark[dx[u] + x][dy[u] + y])
      dfs(dx[u] + x, dy[u] + y);
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  read();
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (!mark[i][j] && A[i][j] == '.') {
        t.clear();
        dfs(i, j);
        for (int k = 0; k < t.size(); k++) ans.push_back({'B', t[k]}), K++;
        for (int k = t.size() - 1; k >= 1; k--)
          ans.push_back({'D', t[k]}), ans.push_back({'R', t[k]}), K += 2;
      }
  printf("%d\n", K);
  for (auto it : ans)
    printf("%6c%6d%6d\n", it.first, it.second.first, it.second.second);
  return 0;
}
