#include<iostream>
#include<algorithm>
#include<math.h>
#include<string.h>
#include<stdio.h>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<sstream>
using namespace std;
const int maxn = 70+5;
const int UP = 0;
const int LEFT = 1;
const int RIGHT = 2;
const int DOWN = 3;
int d[maxn][4][4][3];
int action[maxn][4][4][3];
char seq[maxn], pos[256], footch[] = ".LR";
int energy(int a, int ta) {
if (a == ta)return 3;
if (a + ta == 3)return 7;
return 5;
}
int energy(int i, int a, int b, int s, int f, int &ta, int &tb, int t) {//ta,tb是移动过后的,也就是i+1,f是上一次的集合
ta = a; tb = b;
if (f == 1)ta = t;
else if (f == 2)tb = t;
if (ta == tb)return -1;
if (a == RIGHT && tb != b)return -1;
if (b == LEFT && ta != a)return -1;
if (ta == RIGHT && tb == LEFT)return -1;
int e;
if (f == 0)e = 0;
else if (f != s)e = 1;
else {
if (f == 1)e = energy(a, ta);
else e = energy(b , tb);
}
return e;
}
void update(int i, int a, int b, int s, int f,int t) {
int ta, tb;
int e = energy(i, a, b, s, f, ta,tb,t);
if (e < 0)return;
int cost = d[i + 1][ta][tb][f] + e;
int &ans = d[i][a][b][s];
if (cost < ans) {
ans = cost;
action[i][a][b][s] = f * 4 + t;
}
}
int main() {
pos['U'] = 0; pos['L'] = 1; pos['R'] = 2; pos['D'] = 3;
while (scanf("%s", seq) == 1) {
if (seq[0] == '#')break;
int n = strlen(seq);
memset(seq, 0, sizeof(seq));
for (int i = n - 1; i >= 0; i--) {
for (int a = 0; a < 4; a++) {
for (int b = 0; b < 4; b++)if(a!=b) {
for (int s = 0; s < 3; s++) {
d[i][a][b][s] = 10 * n;
if (seq[i] == '.') {
update(i, a, b, s, 0, 0);//no move
for (int t = 0; t < 4; t++) {
update(i, a, b, s, 1, t);//move a
update(i, a, b, s, 2, t);//move b
}
}
else {
update(i, a, b, s, 1, pos[seq[i]]);//move a
update(i, a, b, s, 2, pos[seq[i]]);//move b
}
}
}
}
}
int a = LEFT, b = RIGHT, s = 0;
for (int i = 0; i < n; i++) {
int f = action[i][a][b][s] / 4;
int t = action[i][a][b][s] % 4;
cout << footch[f];
s = f;
if (f == 1)a = t;
else if (f == 2)b = t;
}
cout << endl;
}
return 0;
}