Problem:


Score : 300 points

Problem Statement

Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up.

Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1.

Here, both the x- and y-coordinates before and after each movement must be integers.

He will first visit the point (tx,ty) where sx < tx and sy < ty, then go back to the point (sx,sy), then visit the point (tx,ty) again, and lastly go back to the point (sx,sy).

Here, during the whole travel, he is not allowed to pass through the same point more than once, except the points (sx,sy) and (tx,ty).

Under this condition, find a shortest path for him.  

Constraints

-1000 ≤ sx < tx ≤ 1000 

-1000 ≤ sy < ty ≤ 1000 

sx,sy,tx and ty are integers.

Input

The input is given from Standard Input in the following format:

sx sy tx ty

Output

Print a string S that represents a shortest path for Dolphin.

The i-th character in S should correspond to his i-th movement.

The directions of the movements should be indicated by the following characters:  

U: Up

D: Down

L: Left

R: Right

If there exist multiple shortest paths under the condition, print any of them.

Sample Input 1

0 0 1 2

Sample Output 1

UURDDLLUUURRDRDDDLLU

One possible shortest path is:

Going from (sx,sy) to (tx,ty) for the first time: (0,0) → (0,1) → (0,2) → (1,2)

Going from (tx,ty) to (sx,sy) for the first time: (1,2) → (1,1) → (1,0) → (0,0)

Going from (sx,sy) to (tx,ty) for the second time: (0,0) → (-1,0) → (-1,1) → (-1,2) → (-1,3) → (0,3) → (1,3) → (1,2)

Going from (tx,ty) to (sx,sy) for the second time: (1,2) → (2,2) → (2,1) → (2,0) → (2,-1) → (1,-1) → (0,-1) → (0,0)

Sample Input 2

-2 -2 1 1

Sample Output 2

UURRURRDDDLLDLLULUUURRURRDDDLLDL



Sample input:
0 0 1 2


Sample output:
UURDDLLUUURRDRDDDLLU

Submission status: Accepted

Solution code:
sx,sy,tx,ty=map(int,input().split())
x=tx-sx
y=ty-sy
def p(h,n):
    for i in range(n):
        print(h,end="")
p("U",y)
p("R",x)
p("D",y)
p("L",x+1)
p("U",y+1)
p("R",x+1)
p("D",1)
p("R",1)
p("D",y+1)
p("L",x+1)
p("U",1)

Submission status: Accepted

Solution code:
sx, sy, tx, ty= map(int, input().split())

move = []
temp_x = 0
temp_y = 0


def move_1(sX, sY, gX, gY):
    temp_x = sX
    temp_y = sY
    while temp_y < gY:
        move.append('U')
        temp_y += 1

    while temp_x < gX:
        move.append('R')
        temp_x += 1

def move_2(sX, sY, gX, gY):
    temp_x = sX
    temp_y = sY
    while temp_y > gY:
        move.append('D')
        temp_y -= 1

    while temp_x > gX:
        move.append('L')
        temp_x -= 1



move_1(sx, sy, tx, ty)
move_2(tx, ty, sx, sy)
move.append('L')
move_1(sx - 1, sy, tx, ty + 1)
move.append('DR')
move_2(tx + 1, ty, sx, sy - 1)
move.append('U')
print(''.join(move))

Submission status: Accepted

Solution code:
import sys
import copy
import string
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

sx, sy, tx, ty = na()
ans = ""
dx = tx - sx
dy = ty - sy

ans += dy * "U"
ans += dx * "R"

ans += dy * 'D'
ans += dx * "L"

ans += "L"
ans += "U" * (dy + 1)
ans += 'R' * (dx + 1)
ans += "D"

ans += "R"
ans += 'D' * (dy + 1)
ans += "L" * (dx + 1)
ans += "U"

print(ans)

Submission status: Accepted

Solution code:
sx,sy,tx,ty=map(int,input().split())
root='U'*(ty-sy)+'R'*(tx-sx)+'D'*(ty-sy)+'L'*(tx-sx)+'L'+'U'*(ty-sy+1)+'R'*(tx-sx+1)+'D'+'R'+'D'*(ty-sy+1)+'L'*(tx-sx+1)+'U'
print(root)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())
ans = "U" * (ty - sy) + "R" * (tx - sx + 1) + "D" * (ty - sy + 1) + "L" * (tx - sx + 1) + "UL" + "U" *  (ty - sy + 1) + "R" * (tx - sx + 1) + "D" * (ty - sy + 1) + "L" * (tx - sx)
print(ans)

Submission status: Accepted

Solution code:
a0,b0,a1,b1=map(int,input().split())
[x,y]=[a1-a0,b1-b0]
print("U"*y+"R"*x+"D"*y+"L"*x+"D"+"R"*(x+1)+"U"*(y+1)+"LU"+"L"*(x+1)+"D"*(y+1)+"R")

Submission status: Accepted

Solution code:
a,b,c,d=map(int,input().split())
#小文字の方は動かさない
x=a
y=b
l=[]
while y<d:
    y+=1
    l.append('U')
while x<c:
    x+=1
    l.append('R')
while y>b:
    y-=1
    l.append('D')
while x>a:
    x-=1
    l.append('L')
x-=1
l.append('L')
while y<=d:
    y+=1
    l.append('U')
while x<c:
    x+=1
    l.append('R')
y-=1
l.append('D')
x+=1
l.append('R')
while y>=b:
    y-=1
    l.append('D')
while x>a:
    x-=1
    l.append('L')
y+=1
l.append('U')
print(''.join(l))

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())

ans = ""
ans += "R" * (tx - sx)
ans += "U" * (ty - sy)
ans += "L" * (tx - sx)
ans += "D" * (ty - sy + 1)
ans += "R" * (tx - sx + 1)
ans += "U" * (ty - sy + 1)
ans += "L"
ans += "U"
ans += "L" * (tx - sx + 1)
ans += "D" * (ty - sy + 1)
ans += "R"

print(ans)

Submission status: Accepted

Solution code:
from collections import deque
sx, sy, tx, ty = [int(x) for x in input().split()]
ret = 'R' * (tx - sx) + 'U' * (ty - sy)
ret += 'L' * (tx - sx) + 'D' * (ty - sy)
ret += 'D' + 'R' * (tx - sx + 1) + 'U' * (ty - sy + 1) + 'L'
ret += 'U' + 'L' * (tx - sx + 1) + 'D' * (ty - sy + 1) + 'R'
print(ret)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = [int(x) for x in input().split()]
ret = 'R' * (tx - sx) + 'U' * (ty - sy)
ret += 'L' * (tx - sx) + 'D' * (ty - sy)
ret += 'D' + 'R' * (tx - sx + 1) + 'U' * (ty - sy + 1) + 'L'
ret += 'U' + 'L' * (tx - sx + 1) + 'D' * (ty - sy + 1) + 'R'
print(ret)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())
lx1 = sx-1
ly1 = sy
lx2 = tx
ly2 = ty+1
rx1 = tx+1
ry1 = ty
rx2 = sx
ry2 = sy-1
ans = ""
sign = ['U', 'R', 'D', 'L', 'L', 'U', 'R', 'D', 'R', 'D', 'L', 'U']
road = [ty-sy, tx-sx, sy-ty, sx-tx, -1, ly2-ly1, lx2-lx1, -1, 1, ry2-ry1, rx2-rx1, 1]
for i in range(12):
    ans += sign[i]*abs(road[i])
print(ans)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())
ans = ""
for _ in range(ty-sy):
    ans += "U"
for _ in range(tx-sx):
    ans += "R"
for _ in range(ty-sy):
    ans += "D"
for _ in range(tx-sx):
    ans += "L"

ans += "L"

for _ in range(ty-sy+1):
    ans += "U"
for _ in range(tx-sx+1):
    ans += "R"

ans += "D"
ans += "R"

for _ in range(ty-sy+1):
    ans += "D"
for _ in range(tx-sx+1):
    ans += "L"

ans += "U"

print(ans)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = [int(x) for x in input().split()]
dx=tx-sx
dy=ty-sy
print('R'*dx+'U'*dy+'L'*dx+'D'*(dy+1)+'R'*(dx+1)+'U'*(dy+1)+'L'+'U'+'L'*(dx+1)+'D'*(dy+1)+'R')

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())

x = tx - sx
y = ty - sy

print('U'*y+'R'*x+'U'+'L'*(x+1)+'D'*(y+1)+'R'*(x+1)+'U'*y+'R'+'D'*(y+1)+'L'*(x+1)+'U')

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sx,sy,tx,ty=map(int,input().split())
dx=tx-sx
dy=ty-sy
keiro=''
keiro+='R'*dx
keiro+='U'*dy
keiro+='L'*dx
keiro+='D'*dy
keiro+='D'
keiro+='R'*(dx+1)
keiro+='U'*(dy+1)
keiro+='LU'
keiro+='L'*(dx+1)
keiro+='D'*(dy+1)
keiro+='R'
print(keiro)

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc051/tasks/abc051_c
# C - Back and Forth

sx, sy, tx, ty = list(map(int, input().split()))

done_list = []
route_list = []

# 1回目
route_list += ['R'] * abs(sx - tx)
route_list += ['U'] * abs(sy - ty)
route_list += ['L'] * abs(sx - tx)
route_list += ['D'] * abs(sy - ty)

# 2回目（ひとつ大回り）
route_list += ['L']
route_list += ['U'] * (abs(sy - ty) + 1)
route_list += ['R'] * (abs(sx - tx) + 1)
route_list += ['D']
route_list += ['R']
route_list += ['D'] * (abs(sy - ty) + 1)
route_list += ['L'] * (abs(sx - tx) + 1)
route_list += ['U']

ans = ''.join(route_list)
print(ans)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())

ans = ''
ans += 'U' * (ty - sy) + 'R' * (tx - sx)
ans += 'D' * (ty - sy) + 'L' * (tx - sx)
ans += 'L' + 'U' * (ty - sy + 1) + 'R' * (tx - sx + 1) + 'D'
ans += 'R' + 'D' * (ty - sy + 1) + 'L' * (tx - sx + 1) + 'U'

print(ans)

Submission status: Accepted

Solution code:
sx,sy,tx,ty = map(int, input().strip().split(' '))
print('U'*(ty-sy)+'R'*(tx-sx+1)+'D'*(ty-sy+1)+'L'*(tx-sx+1)+'UL'+'U'*(ty-sy+1)+'R'*(tx-sx+1)+'D'*(ty-sy+1)+'L'*(tx-sx))

Submission status: Accepted

Solution code:
sx,sy,tx,ty = map(int,input().split())
w = abs(tx-sx)
h = abs(ty-sy)
ans = ""
ans += (("R" * w) + ("U" * h) + ("L" * w) + ("D" * h) + "D" + ("R" * (w+1)) + ("U" * (h+1)) + "LU" + ("L" * (w+1)) + ("D" * (h+1)) + "R")
print(ans)

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    # UUR
    # DDL
    # LU UUR RD
    # RD DDL LU

    sx, sy, tx, ty = map(int, input().split())

    result = (
        "U" * (ty - sy)
        + "R" * (tx - sx)
        + "D" * (ty - sy)
        + "L" * (tx - sx)
        + "LU"
        + "U" * (ty - sy)
        + "R" * (tx - sx)
        + "RD"
        + "RD"
        + "D" * (ty - sy)
        + "L" * (tx - sx)
        + "LU"
    )

    print(result)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())
ans = ""
for i in range(sx, tx):
    ans += "R"
for i in range(sy, ty):
    ans += "U"
for i in range(sx, tx):
    ans += "L"
for i in range(sy, ty):
    ans += "D"
ans += "L"
for i in range(sy, ty+1):
    ans += "U"
for i in range(sx, tx+1):
    ans += "R"
ans += "D"
ans += "R"
for i in range(sy, ty+1):
    ans += "D"
for i in range(sx, tx+1):
    ans += "L"
ans += "U"
print(ans)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())

out = ""
def p(s):
    global out
    out += s
# 1回目 行き
for i in range(ty-sy):
    p("U")
for i in range(tx-sx):
    p("R")

# 1回目 帰り
for i in range(ty-sy):
    p("D")
for i in range(tx-sx):
    p("L")

# 2回目 行き
p("L")
for i in range(ty-sy+1):
    p("U")
for i in range(tx-sx+1):
    p("R")
p("D")
# 2回目 帰り
p("R")
for i in range(ty-sy+1):
    p("D")
for i in range(tx-sx+1):
    p("L")
p("U")
print(out)

Submission status: Accepted

Solution code:
sx,sy,tx,ty = map(int,input().split())
w = tx - sx 
h = ty - sy 
ans = []
ans_1 = ["R"]*w + ["U"]*h 
ans_2 = ["L"]*w + ["D"]*h
ans_3 = ["D"] + ["R"] * (w+1) + ["U"] *(h+1) + ["L"]
ans_4 = ["U"] + ["L"] * (w+1)  + ["D"]*(h+1) +["R"]
ans = ans_1 + ans_2 + ans_3 + ans_4 
ans = "".join(ans)
print(ans,end=" ")

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())
x = tx-sx
y = ty-sy
print("U" * y + "R" * x + "D" * y + "L" * (x+1) + "U" * (y+1) + "R" * (x+1) + "D" + "R" + "D" * (y+1) + "L" * (x+1) + "U")

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())

w = tx - sx
h = ty - sy

s = ''
s += 'U'
s += 'U' * (h - 1)
s += 'R' * w
s += 'D'
s += 'D' * (h - 1)
s += 'L' * w
s += 'L'
s += 'U' * (h + 1)
s += 'R' * (w + 1)
s += 'D'
s += 'R'
s += 'D' * (h + 1)
s += 'L' * (w + 1)
s += 'U'

print(s)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

sx, sy, tx, ty = map(int, input().split())

h = ty - sy
w = tx - sx

ans = "U"*h
ans += "R"*w
ans += "D"*h
ans += "L"*(w+1)
ans += "U"*(h+1)
ans += "R"*(w+1)
ans += "D"
ans += "R"
ans += "D"*(h+1)
ans += "L"*(w+1)
ans += "U"

print(ans)

Submission status: Accepted

Solution code:
def main():
    sx, sy, tx, ty = map(int, input().split())
    dx = tx - sx
    dy = ty - sy
    path = "R"*dx + "U"*dy + "L"*dx + "D"*dy
    path += "D" + "R"*(dx+1)+ "U"*(dy+1)+"L"+"U"+"L"*(dx+1)+ "D"*(dy+1) + "R"
    return path

if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())
tx -= sx
ty -= sy
sx = 0
sy = 0

for _ in range(tx - sx):
    print('R', end = '')
for _ in range(ty - sy):
    print('U', end = '')

for _ in range(tx - sx):
    print('L', end = '')
for _ in range(ty - sy):
    print('D', end = '')
    
print('L', end = '')
for _ in range(ty - sy + 1):
    print('U', end = '')
for _ in range(tx - sx + 1):
    print('R', end = '')
print('D', end = '')

   
print('R', end = '')
for _ in range(ty - sy + 1):
    print('D', end = '')
for _ in range(tx - sx + 1):
    print('L', end = '')
print('U', end = '')

Submission status: Accepted

Solution code:
sx,sy,tx,ty=map(int,input().split())

way_1="U"*(ty-sy)+"R"*(tx-sx)
way_2="D"*(ty-sy)+"L"*(tx-sx)
way_3="L"+"U"*(ty-sy+1)+"R"*(tx-sx+1)+"D"
way_4="R"+"D"*(ty-sy+1)+"L"*(tx-sx+1)+"U"

print(way_1+way_2+way_3+way_4)

Submission status: Accepted

Solution code:
H = list(map(int, input().split()))
SX=H[0]
SY=H[1]
TX=H[2]
TY=H[3]
TX=TX-SX
TY=TY-SY

if((TX>=0)&(TY>=0)):
    U="U"
    R="R"
    D="D"
    L="L"

if((TX<0)&(TY>=0)):
    U="U"
    R="L"
    D="D"
    L="R"

if((TX>=0)&(TY<0)):
    U="D"
    R="R"
    D="U"
    L="L"

if((TX<0)&(TY<0)):
    U="D"
    R="L"
    D="U"
    L="R"

for i in range(abs(TY)):print(U,end="") 
for i in range(abs(TX)):print(R,end="") 

for i in range(abs(TY)):print(D,end="")
for i in range(abs(TX)):print(L,end="") 

print(L,end="") 
for i in range(abs(TY)+1):print(U,end="")
for i in range(abs(TX)+1):print(R,end="") 
print(D,end="")

print(R,end="") 
for i in range(abs(TY)+1):print(D,end="")
for i in range(abs(TX)+1):print(L,end="") 
print(U,end="")

Submission status: Accepted

Solution code:
li=list(map(int,input().split()))

yoko=li[2]-li[0]
tate=li[3]-li[1]
s=["R"]*yoko+["U"]*tate+["L"]*yoko
s+=["D"]*(tate+1)+["R"]*(yoko+1)+["U"]*(tate+1)+["L"]
s+=["U"]+["L"]*(yoko+1)+["D"]*(tate+1)+["R"]
ans=''.join(s)

print(ans)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())
 
right1 = ["R" for _ in range(tx-sx)]
up1 = ["U" for _ in range(ty-sy)]
left1 = ["L" for _ in range(tx-sx)]
down1 = ["D" for _ in range(ty-sy)]
hoge = ["D"]
right2 = ["R" for _ in range(tx-sx+1)]
up2 = ["U" for _ in range(ty-sy+1)]
hoge2 = ["LU"]
left2 = ["L" for _ in range(tx-sx+1)]
down2 = ["D" for _ in range(ty-sy+1)]
hoge3 = ["R"]
print("".join(right1+up1+left1+down1+hoge+right2+up2+hoge2+left2+down2+hoge3))

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def main():
    sx, sy, tx ,ty  = map(int, input().split())
    dx = tx - sx
    dy = ty - sy

    p1 = 'R' * dx + 'U' * dy
    p2 = 'L' * dx + 'D' * dy
    p3 = 'D' + 'R' * (dx + 1) + 'U' * (dy + 1) + 'L'
    p4 = 'U' + 'L' * (dx + 1) + 'D' * (dy + 1) + 'R'
    print(p1 + p2 + p3 + p4)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())

dx = tx - sx
dy = ty - sy

ans = 'U' * dy + 'R' * dx
ans += 'D' * dy + 'L' * dx
ans += 'L' + 'U' * (dy + 1) + 'R' * (dx + 1) + 'D'
ans += 'R' + 'D' * (dy + 1) + 'L' * (dx + 1) + 'U'
print(ans)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())

right1 = ["R" for _ in range(tx-sx)]
up1 = ["U" for _ in range(ty-sy)]
left1 = ["L" for _ in range(tx-sx)]
down1 = ["D" for _ in range(ty-sy)]
hoge = ["D"]
right2 = ["R" for _ in range(tx-sx+1)]
up2 = ["U" for _ in range(ty-sy+1)]
hoge2 = ["LU"]
left2 = ["L" for _ in range(tx-sx+1)]
down2 = ["D" for _ in range(ty-sy+1)]
hoge3 = ["R"]
print("".join(right1+up1+left1+down1+hoge+right2+up2+hoge2+left2+down2+hoge3))

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())
x, y = tx - sx, ty - sy
print("U"*y + "R"*x + "D"*y + "L"*x +
      "L" + "U"*(y+1) + "R"*(x+1) + "D" +
      "R" + "D"*(y+1) + "L"*(x+1) + "U")

Submission status: Accepted

Solution code:
sx, sy, gx, gy = [ int(v) for v in input().split() ]
dx, dy = gx - sx, gy - sy


ans_1 = "R" * dx + "U" * dy
ans_2 = "L" + "D" * (dy-1) + "L" * (dx-1) + "D"
ans_3 = "D" + "R" * (dx+1) + "U" * (dy+1) + "L"
ans_4 = "U" + "LL" + "D" * (dy-1) + "L" * (dx-1) + "DD" + "R"

print(ans_1+ans_2+ans_3+ans_4)

Submission status: Accepted

Solution code:
Sx, Sy, Tx, Ty = map(int, input().split())

Dx = Tx - Sx
Dy = Ty - Sy

g1 = ['U'] * Dy + ['R'] * Dx
g = ''.join(g1)

r1 = ['D'] * Dy + ['L'] * Dx
r = ''.join(r1)

print('{}{}LU{}RDRD{}LU'.format(g, r, g, r))

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())

move_x = tx - sx
move_y = ty - sy

move1 = 'R'*move_x + 'U'*move_y
move2 = 'L'*move_x + 'D'*move_y
move3 = 'D' + 'R'*(move_x+1) + 'U'*(move_y+1) + 'L'
move4 = 'U' + 'L'*(move_x+1) + 'D'*(move_y+1) + 'R'

print(move1 + move2 + move3 + move4)

Submission status: Accepted

Solution code:
sx,sy,tx,ty = map(int,input().split())
print('U'*(ty-sy), end='')
print('R'*(tx-sx), end='')
print('D'*(ty-sy), end='')
print('L'*(tx-sx+1), end='')
print('U'*(ty-sy+1), end='')
print('R'*(tx-sx+1), end='')
print('D',end='')
print('R',end='')
print('D'*(ty-sy+1), end='')
print('L'*(tx-sx+1), end='')
print('U')

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())
w = tx-sx
h = ty-sy
s = ""
s += "U"*h
s += "R"*w
s += "D"*h
s += "L"*w
s += "L"
s += "U"*(h+1)
s += "R"*(w+1)
s += "D"
s += "R"
s += "D"*(h+1)
s += "L"*(w+1)
s += "U"
print(s)

Submission status: Accepted

Solution code:
sx,sy,tx,ty = [int(i) for i in input().split()]
ans = ""
for i in range(ty-sy):
    ans += "U"
for i in range(tx-sx):
    ans += "R"
for i in range(ty-sy):
    ans += "D"
for i in range(tx-sx):
    ans += "L"
ans += "L"
for i in range(ty-sy+1):
    ans += "U"
for i in range(tx-sx+1):
    ans += "R"
ans += "D"
ans += "R"
for i in range(ty-sy+1):
    ans += "D"
for i in range(tx-sx+1):
    ans += "L"
ans += "U"

print(ans)

Submission status: Accepted

Solution code:
(sx, sy, tx, ty) = map(int, input().split())

dx = tx - sx
dy = ty - sy

result = []
result.extend(['R' for _ in range(dx)])
result.extend(['U' for _ in range(dy)])
result.extend(['L' for _ in range(dx)])
result.extend(['D' for _ in range(dy + 1)])
result.extend(['R' for _ in range(dx + 1)])
result.extend(['U' for _ in range(dy + 1)])
result.extend(['L'])
result.extend(['U'])
result.extend(['L' for _ in range(dx + 1)])
result.extend(['D' for _ in range(dy + 1)])
result.extend(['R'])
print("".join(result))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

if __name__ == '__main__':
    sx, sy, tx, ty = map(int, input().split(' '))

    right = tx - sx
    up = ty - sy

    R = ['R'] * right
    U = ['U'] * up
    down = ['D'] * (up+1)
    left = ['L'] * (right+1)

    one = []
    one.extend(R)
    one.extend(U)
    one.append('R')
    one.extend(down)
    one.extend(left)
    one.append('U')

    one.extend(U)
    one.extend(R)
    one.append('U')
    one.extend(left)
    one.extend(down)
    one.append('R')

    out = ''.join(one)
    print(out)

Submission status: Accepted

Solution code:
sx,sy,tx,ty=map(int,input().split())
route=''
route+='U'*(ty-sy)
route+='R'*(tx-sx)
route+='D'*(ty-sy)
route+='L'*(tx-sx)
route+='L'
route+='U'*(ty-sy+1)
route+='R'*(tx-sx+1)
route+='DR'
route+='D'*(ty-sy+1)
route+='L'*(tx-sx+1)
route+='U'
print(route)

Submission status: Accepted

Solution code:
def saitankeiro(s,t):
  dx = t[0] - s[0]
  dy = t[1] - s[1]
  
  # loop 1
  for i in range(0,dy):
    print('U',end='')
  
  for i in range(0,dx):
    print('R',end='')
  
  for i in range(0,dy):
    print('D',end='')

  for i in range(0,dx):
    print('L',end='')
  
  #loop 2
  print('L',end='')
  for i in range(0,dy+1):
    print('U',end='')
  
  for i in range(0, dx+1):
    print('R',end='')
  
  print('D',end='')

  print('R',end='')
  for i in range(0,dy+1):
    print('D',end='')
  
  for i in range(0, dx+1):
    print('L',end='')
  
  print('U',end='')

sx, sy, tx, ty = list(map(int, input().split()))

saitankeiro([sx,sy], [tx, ty])

Submission status: Accepted

Solution code:
def moving(delta_x,delta_y):
    go_1="U"*delta_y+"R"*delta_x
    back_1="D"*delta_y+"L"*delta_x
    go_2="L"+"U"*(delta_y+1)+"R"*(delta_x+1)+"D"
    back_2="R"+"D"*(delta_y+1)+"L"*(delta_x+1)+"U"
    return(go_1+back_1+go_2+back_2)

sx,sy,tx,ty=map(int,input().split(" "))
delta_x=tx-sx
delta_y=ty-sy
print(moving(delta_x,delta_y))

Submission status: Accepted

Solution code:
a,b,c,d = map(int,input().split())
x=c-a
y=d-b
print('R'*x+'U'*(y+1)+'L'*(x+1)+'D'*(y+1)+'R'+'U'*y+'R'*(x+1)+'D'*(y+1)+'L'*(x+1)+'U')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

sx,sy,tx,ty = map(int, input().split())
ans = ['U'] * (ty - sy) + ['R'] * (tx - sx)
ans += ['D'] * (ty - sy) + ['L'] * (tx - sx)
ans += ['L'] + ['U'] * (ty - sy + 1) + ['R'] * (tx - sx + 1) + ['D']
ans += ['R'] + ['D'] * (ty - sy + 1) + ['L'] * (tx - sx + 1) + ['U']
print(''.join(ans))

Submission status: Accepted

Solution code:
a,b,c,d=map(int,input().split())
x=c-a
y=d-b
s=""
s+="U"*y+"R"*x
s+="D"*y+"L"*x
s+="L"+"U"*(y+1)+"R"*(x+1)+"D"
s+="R"+"D"*(y+1)+"L"*(x+1)+"U"
print(s)

Submission status: Accepted

Solution code:
a,b,c,d = map(int, input().split())
x = c - a
y = d - b

ans = 'R'*x + 'U'*y 
ans += 'L'*x + 'D'*y
ans += 'D'*1 + 'R'*(x+1) + 'U'*(y+1) + 'L'*1
ans += 'U'*1 + 'L'*(x+1) + 'D'*(y+1) + 'R'*1

print(ans)

Submission status: Accepted

Solution code:
x1, y1, x2, y2 = map(int, input().split())
x = abs(x1 - x2)
y = abs(y1 - y2)
a = ""
a += ("U" * y + "R" * x + "D" * y + "L" * x)
a += ("L" + "U" * (y + 1) + "R" * (x + 1) + "D" + "R" + "D" * (y + 1) + "L" * (x + 1) + "U")
print(a)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())

holizontal = tx - sx
vertical = ty - sy

ans = ['L']
ans += ['U'] * (vertical + 1)
ans += ['R'] * (holizontal + 1)
ans += ['D']
ans += ['L'] * holizontal
ans += ['D'] * (vertical + 1)
ans += ['R'] * (holizontal + 1)
ans += ['U'] * (vertical + 1)
ans += ['L']
ans += ['D'] * vertical
ans += ['L'] * holizontal

print(''.join(ans))

Submission status: Accepted

Solution code:
sx,sy,tx,ty = map(int,input().split())
ans = ""
r = tx-sx
u = ty-sy

ans += "R"*r+"U"*u+"L"*r+"D"*u
ans += "D"+"R"*(r+1)+"U"*(u+1)+"L"
ans += "U"+"L"*(r+1)+"D"*(u+1)+"R"

print(ans)

Submission status: Accepted

Solution code:
from sys import exit, stdin
sx, sy, tx, ty = [int(_) for _ in stdin.readline().rstrip().split()]
dx, dy = tx-sx, ty-sy
print(dy*'U'+dx*'R'+dy*'D'+dx*'L'+'L'+'U'+dy*'U'+dx*'R'+'R'+'D'+'R'+dy*'D'+'D'+'L'+dx*'L'+'U')

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())
dx = tx - sx
dy = ty - sy
print("U" * dy + "R" * dx + "D" * dy + "L" * dx + "L" + "U" * (dy + 1) + "R" * (dx + 1) + "DR" + "D" * (dy + 1) + "L" * (dx + 1) + "U")

Submission status: Accepted

Solution code:
# 2019/08/13

sx,sy,tx,ty=map(int,input().split())

lr=tx-sx
ud=ty-sy

ans=[('R'*lr),
    ('U'*ud),
    ('L'*lr),
    ('D'*ud),
    ('D'),
    ('R'*(lr+1)),
    ('U'*(ud+1)),
    ('L'),
    ('U'),
    ('L'*(lr+1)),
    ('D'*(ud+1)),
    ('R')
    ]
print(''.join(ans))

Submission status: Accepted

Solution code:
x0,y0,x1,y1 = map(int,input().split())
x1 -= x0
y1 -= y0
ans = ''
ans += 'R' * x1
ans += 'U' * y1
ans += 'L' * x1
ans += 'D' * y1
ans += 'D'
ans += 'R' * x1
ans += 'R'
ans += 'U' * y1
ans += 'U'
ans += 'L'
ans += 'U'
ans += 'L' * x1
ans += 'L'
ans += 'D' * y1
ans += 'D'
ans += 'R'
print(ans)

Submission status: Accepted

Solution code:
a=list(map(int,input().split()))
b,c=a[2]-a[0],a[3]-a[1]
d,e=b+1,c+1
print('R'*b+'U'*c+'L'*b+'D'*c+'D'+'R'*d+'U'*e+'L'+'U'+'L'*d+'D'*e+'R',end='')

Submission status: Accepted

Solution code:
sx, sy, ex, ey = [int(v) for v in input().split()]


def move(x):
    print(x, end='')


def forward(x1, y1, x2, y2):
    for _ in range(y1, y2):
        move('U')
    for _ in range(x1, x2):
        move('R')


def backword(x1, y1, x2, y2):
    for _ in range(y1, y2):
        move('D')
    for _ in range(x1, x2):
        move('L')


forward(sx, sy, ex, ey)
backword(sx, sy, ex, ey)
move('L')
forward(sx - 1, sy, ex, ey + 1)
move('D')
move('R')
backword(sx, sy - 1, ex + 1, ey)
print('U')

Submission status: Accepted

Solution code:
A = list(map(int,input().split()))
dx = A[2] - A[0]
dy = A[3] - A[1]
sta = "U" * dy + "R" * dx + "D" * dy + "L" * dx
stb = "L" + "U" * (dy + 1) + "R" * (dx + 1) + "D"
stc = "R" + "D" * (dy + 1) + "L" * (dx + 1) + "U"
st = sta + stb + stc
print(st)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = [int(x) for x in input().split()]

dx = tx - sx
dy = ty - sy

for _ in range(dx):
	print('R',end='')
for _ in range(dy):
	print('U',end='')
for _ in range(dx):
	print('L',end='')
for _ in range(dy + 1):
	print('D',end='')
for _ in range(dx + 1):
	print('R',end='')
for _ in range(dy + 1):
	print('U',end='')
print('L',end='')
print('U',end='')
for _ in range(dx + 1):
	print('L',end='')
for _ in range(dy + 1):
	print('D',end='')
print('R')

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())

ans = ''
ans += 'R' * (tx - sx)
ans += 'U' * (ty - sy)
ans += 'L' * (tx - sx)
ans += 'D' * (ty - sy)
ans += 'D' + 'R' * (tx - sx + 1)
ans += 'U' * (ty - sy + 1) + 'L'
ans += 'U' + 'L' * (tx - sx + 1)
ans += 'D' * (ty - sy + 1) + 'R'

print(ans)

Submission status: Accepted

Solution code:
sx,sy,tx,ty = map(int,input().split())

ans = ""
ans+="L"
for i in range(ty - sy + 1):
    ans+="U"
for i in range(tx - sx + 1):
    ans+="R"
ans+="D"
ans+="R"
for i in range(ty - sy + 1):
    ans+="D"
for i in range(tx - sx + 1):
    ans+="L"
for i in range(ty - sy + 1):
    ans+="U"
for i in range(tx - sx):
    ans+="R"
for i in range(ty - sy):
    ans+="D"
for i in range(tx - sx):
    ans+="L"

print(ans)

Submission status: Accepted

Solution code:
sx,sy,tx,ty = map(int,input().split())
ans = ''

ans += 'U'*(ty - sy)
ans += 'R'*(tx - sx)
ans += 'D'*(ty - sy)
ans += 'L'*(tx - sx)

ans += 'L'
ans += 'U'*(ty - sy + 1)
ans += 'R'*(tx - sx + 1)
ans += 'D'
ans += 'R'
ans += 'D'*(ty - sy + 1)
ans += 'L'*(tx - sx + 1)
ans += 'U'

print(ans)

Submission status: Accepted

Solution code:
sx,sy,tx,ty=[int(i) for i in input().split()]
x=tx-sx
y=ty-sy

procedure=[]
#一回目
for i in range(x):
    procedure.append("R")
for i in range(y):
    procedure.append("U")
for i in range(x):
    procedure.append("L")
for i in range(y):
    procedure.append("D")
    
#2回目
procedure.append("D")
for i in range(x+1):
    procedure.append("R")
for i in range(y+1):
    procedure.append("U")
procedure.append("L")
procedure.append("U")
for i in range(x+1):
    procedure.append("L")
for i in range(y+1):
    procedure.append("D")
procedure.append("R")

print("".join(procedure))

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())
ans = ("R" * (tx - sx) + "U" * (ty - sy) + "L" * (tx - sx) + "D" * (ty - sy) + 
       "D" + "R" * (tx + 1 - sx) + "U" * (ty + 1 - sy) + "L" + "U" + "L" * (tx + 1 - sx) + "D" * (ty + 1 - sy) + "R")
print(ans)

Submission status: Accepted

Solution code:
a,b,c,d = map(int, input().split())
x = c-a
y = d-b
y1=''
y2=''
for i in range(y):
  y1+='U'
  y2+='D'
x1=''
x2=''
for i in range(x):
  x1+='R'
  x2+='L'
print(y1+x1+y2+x2+'L'+y1+'UR'+x1+'DR'+y2+'DL'+x2+'U')

Submission status: Accepted

Solution code:
sx, sy, tx, ty = [int(x) for x in input().split()]

tx -= sx
ty -= sy

print((
("U"*ty)+("R"*tx)+
("D"*ty)+("L"*tx)+
"L"+ ("U"*(ty+1))+("R"*(tx+1))+ "D"+
"R"+ ("D"*(ty+1))+("L"*(tx+1))+
"U"))

Submission status: Accepted

Solution code:
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
  return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

sx,sy,tx,ty = II()

move = ['U']*(ty-sy) + ['R']*(tx-sx) + ['D']*(ty-sy) + ['L']*(tx-sx)
move2 = ['L'] + ['U']*(ty-sy+1) + ['R']*(tx-sx+1) + ['D'] + \
        ['R'] + ['D']*(ty-sy+1) + ['L']*(tx-sx+1) + ['U']

ans = move+move2
print(*ans,sep='')

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().rstrip().split())
dx = tx - sx
dy = ty - sy
ret = ""
ret += "R"*dx + "U"*dy
ret += "L"*dx + "D"*dy
ret += "D"
ret += "R"*dx + "R" + "U"*dy + "U"
ret += "L"
ret += "U"
ret += "L"*dx + "L" + "D"*dy + "D"
ret += "R"
print(ret)

Submission status: Accepted

Solution code:
sx,sy,tx,ty=map(int,input().split())
y=tx-sx
x=ty-sy
path=""
path+="U"*x+"R"*y+"D"*x+"L"*y
path+="L"+"U"*(x+1)+"R"*(y+1)+"D"+"R"+"D"*(x+1)+"L"*(y+1)+"U"
print(path)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())
x_diff = tx-sx
y_diff = ty-sy
path = 'U'*(y_diff) + 'R'*(x_diff) + 'D'*(y_diff) + 'L'*(x_diff)
path += 'L' + 'U'*(y_diff+1) + 'R'*(x_diff+1) + 'DR' + 'D'*(y_diff+1) + 'L'*(x_diff+1) + 'U'
print(path)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())

dx = tx - sx
dy = ty - sy

ans = "R"*dx + "U"*dy + "L"*dx + "D"*(dy + 1) + "R"*(dx+1) + "U"*(dy+1) + "L" + "U" + "L"*(dx+1) + "D"*(dy+1) + "R"

print(ans)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = [int(x) for x in input().split()]

dx = tx -sx
dy = ty -sy

c = ['U', 'D', 'L', 'R']

print(c[0]*dy+c[3]*dx+c[1]*dy+c[2]*dx 
 + c[2] + c[0]*(dy+1) +c[3]*(dx+1) + c[1] 
 + c[3] + c[1]*(dy+1) + c[2]*(dx+1) + c[0])

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())
x_plus = tx - sx
y_plus = ty - sy
first_go = 'R'*x_plus + 'U'*y_plus
first_back = 'L'*x_plus + 'D'*y_plus
second_go = 'DR' + first_go + 'UL'
second_back = 'UL' + first_back + 'DR'
print(first_go + first_back + second_go + second_back)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())

print('U' * (ty - sy) + 'R' * (tx - sx) + 'D' * (ty - sy) + 'L' * (tx - sx) + 'L' + 'U' * (ty - sy + 1) + 'R' * (tx - sx + 1) + 'DR'  + 'D' * (ty - sy + 1) + 'L' * (tx - sx + 1) + 'U')

Submission status: Accepted

Solution code:
sx,sy,tx,ty  = list(map(int,input().split()))
string = ""  
if sy == ty:
  string += "R"*(tx-sx)
  string += "D"+"L"*(tx-sx)+"U"
  string += "U"+"R"*(tx-sx)+"D"
  string += "RUU"+"L"*(tx-sx+2)+"DDR"
  if sx > tx:
    string.replace("R","X").replace("L","R").replace("X","L")
elif sy == ty:
  string += "U"*(tx-sx)
  string += "R"+"D"*(tx-sx)+"L"
  string += "L"+"U"*(tx-sx)+"R"
  string += "ULL"+"D"*(tx-sx+2)+"RRU"
  if sy > ty:
    string.replace("D","X").replace("U","D").replace("X","U")
else:
  g = []
  if sx<tx:
    g += ["R","L"]
  else:
    g += ["L","R"]
  
  if sy<ty:
    g += ["U","D"]
  else:
    g += ["D","U"]
  
  dx,dy = abs(tx-sx),abs(ty-sy)
  
  string += g[0]*dx+g[2]*dy
  string += g[1]*dx+g[3]*dy
  string += g[3]+g[0]+g[0]*dx+g[2]*dy+g[2]+g[1]
  string += g[2]+g[1]+g[1]*dx+g[3]*dy+g[3]+g[0]
  
print(string)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())

dx = abs(tx -  sx)
dy = abs(ty - sy)
print("U" * dy + "R" * dx + "D" * dy + "L" * dx, end="")
print("L" + "U" * (dy+1) + "R" * (dx+1) + "D" + "R" + "D" * (dy+1) + "L" * (dx+1) + "U")

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())
diff_x = tx-sx
diff_y = ty-sy

ans = ''
ans += 'U'*abs(diff_y) if diff_x>0 else 'D'*abs(diff_y) # 1
ans += 'R'*abs(diff_x+1) if diff_x>0 else 'L'*abs(diff_x+1) # 2
ans += 'U'*(abs(diff_y)+1) if diff_x<0 else 'D'*(abs(diff_y)+1) # 3
ans += 'R'*abs(diff_x+1) if diff_x<0 else 'L'*abs(diff_x+1) # 4
ans += 'U' if diff_x>0 else 'D' # 1
ans += 'R' if diff_x<0 else 'L' # 2

ans += 'U'*abs(diff_y+1) if diff_x>0 else 'D'*abs(diff_y+1) # 1
ans += 'R'*abs(diff_x+1) if diff_x>0 else 'L'*abs(diff_x+1) # 2

ans += 'U'*(abs(diff_y)+1) if diff_x<0 else 'D'*(abs(diff_y)+1) # 3
ans += 'R'*abs(diff_x) if diff_x<0 else 'L'*abs(diff_x) # 2
print(ans)