#!/usr/bin/perl -w

use strict;
use v5.30;

$; = ',';
my %pos2num = (
	"0,0" => 1,
	"1,0" => 2,
	"2,0" => 3,
	"0,1" => 4,
	"1,1" => 5,
	"2,1" => 6,
	"0,2" => 7,
	"1,2" => 8,
	"2,2" => 9,
);
my @pos = (1, 1);
my $ret = '';
while (<>) {
	chomp;
	for my $step (split //) {
		$pos[0]-- if $pos[0] && $step eq 'L';
		$pos[0]++ if $pos[0] < 2 && $step eq 'R';
		$pos[1]-- if $pos[1] && $step eq 'U';
		$pos[1]++ if $pos[1] < 2 && $step eq 'D';
	}
	$ret .= $pos2num{$pos[0],$pos[1]};
}

say $ret;

