#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
long double PI = acosl(-1);
const long long infl = 1e18 + 100;
const int inf = 2e9 + 100;
const int nmax = 2e5 + 5;
const int MAXLG = log2(nmax) + 1;
vector<string> s(6);
string ans;
int movedone;
void swapwithup(int pos) {
  int R = pos / 6, C = pos % 6;
  string row = "1", col = "1";
  row[0] = char('1' + R), col[0] = char('1' + C);
  string tmp = "L" + row + "D" + col + "L" + row + "U" + col;
  string muv = tmp + tmp + tmp + "L" + row;
  ans += muv;
  swap(s[R][C], s[(R + 5) % 6][C]);
  movedone++;
}
void swapwithright(int pos) {
  int R = pos / 6, C = pos % 6;
  string row = "1", col = "1";
  row[0] = char('1' + R), col[0] = char('1' + C);
  string tmp = "D" + col + "L" + row + "D" + col + "R" + row;
  string muv = tmp + tmp + tmp + "D" + col;
  ans += muv;
  swap(s[R][C], s[R][(C + 1) % 6]);
  movedone++;
}
int khoj(char ch) {
  for (int i = 0; i < 6; i++)
    for (int j = 0; j < 6; j++)
      if (s[i][j] == ch) return i * 6 + j;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int hui = 0;
  map<char, int> koi;
  vector<char> shob;
  for (char ch = '0'; ch <= '9'; ch++) koi[ch] = hui++, shob.push_back(ch);
  for (char ch = 'A'; ch <= 'Z'; ch++) koi[ch] = hui++, shob.push_back(ch);
  for (auto &x : s) cin >> x;
  for (char ch : shob) {
    while (true) {
      int p = khoj(ch);
      if (p % 6 == 5) break;
      swapwithright(p);
    }
    while (true) {
      int p = khoj(ch);
      if (p / 6 == koi[ch] / 6) break;
      swapwithup(p);
    }
    while (true) {
      int p = khoj(ch);
      if (p == koi[ch]) break;
      swapwithright(p - 1);
    }
  }
  cout << ans.size() / 2 << "\n";
  for (int i = 0; i < ans.size(); i += 2) cout << ans[i] << ans[i + 1] << '\n';
}
