package main
import (
"fmt"
"strings"
)
func main() {
in, out := "", ""
fmt.Scan(&in, &out)
ins := strings.Split(in, ",")
outs := strings.Split(out, ",")
ans := ""
var queue []string
for _, s := range outs {
for {
if len(queue) == 0 {
queue = append(queue, ins[0])
ins = ins[1:]
}
str := get(&queue, s)
if str == "" {
if len(ins) == 0 {
fmt.Println("No")
return
}
queue = append(queue, ins[0])
ins = ins[1:]
} else {
ans += str
break
}
}
}
fmt.Println(ans)
}
func get(q *[]string, s string) string {
queue := *q
if len(queue) == 0 {
}
if queue[0] == s {
*q = queue[1:]
return "L"
}
if queue[len(queue)-1] == s {
*q = queue[:len(queue)-1]
return "R"
}
return ""
}