#include <bits/stdc++.h>
using namespace std;
vector<pair<char, int> > ans;
int tr[300], a[7][7];
char ch[10];
void swapy(int x, int y1, int y2) {
  if (y1 == y2) return;
  if (y1 > y2) swap(y1, y2);
  int d = y2 - y1;
  for (int t = 1; t <= 3; ++t) {
    ans.push_back(make_pair('D', y2));
    for (int i = 0; i < d; ++i) ans.push_back(make_pair('R', x));
    ans.push_back(make_pair('D', y2));
    for (int i = 0; i < d; ++i) ans.push_back(make_pair('L', x));
  }
  ans.push_back(make_pair('D', y2));
}
void swapx(int x, int y1, int y2) {
  if (y1 == y2) return;
  if (y1 > y2) swap(y1, y2);
  int d = y2 - y1;
  for (int t = 1; t <= 3; ++t) {
    ans.push_back(make_pair('R', y2));
    for (int i = 0; i < d; ++i) ans.push_back(make_pair('D', x));
    ans.push_back(make_pair('R', y2));
    for (int i = 0; i < d; ++i) ans.push_back(make_pair('U', x));
  }
  ans.push_back(make_pair('R', y2));
}
void iswap(int x1, int y1, int x2, int y2) {
  swap(a[x1][y1], a[x2][y2]);
  swapy(x1, y1, y2);
  if (x1 != x2) {
    swapx(y2, x1, x2);
    swapy(x1, y1, y2);
  }
}
bool v[7][7];
void dfs(int x, int y) {
  if (v[x][y]) return;
  v[x][y] = 1;
  dfs(a[x][y] / 6, a[x][y] % 6);
  iswap(x, y, a[x][y] / 6, a[x][y] % 6);
}
int main() {
  for (int i = 0; i <= 9; ++i) tr[i + '0'] = i;
  for (int i = 0; i < 26; ++i) tr[i + 'A'] = i + 10;
  for (int i = 0; i < 6; ++i) {
    scanf("%s", ch);
    for (int j = 0; j < 6; ++j) a[i][j] = tr[ch[j]];
  }
  for (int i = 0; i < 6; ++i)
    for (int j = 0; j < 6; ++j) dfs(i, j);
  printf("%d\n", (int)ans.size());
  for (int i = 0; i < (int)ans.size(); ++i)
    printf("%c%d\n", ans[i].first, ans[i].second + 1);
  return 0;
}
