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:
def sign(n):
    if 0 <= n:
        return 1
    return -1

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

w, h = tx-sx, ty-sy

text = ""
text += "_UD"[sign(h)] * abs(h)
text += "_RL"[sign(w)] * abs(w)
text += "_DU"[sign(h)] * abs(h)
text += "_LR"[sign(w)] * (abs(w)+1)
text += "_UD"[sign(h)] * (abs(h)+1)
text += "_RL"[sign(w)] * (abs(w)+1)
text += "_DU"[sign(h)]
text += "_RL"[sign(w)]
text += "_DU"[sign(h)] * (abs(h)+1)
text += "_LR"[sign(w)] * (abs(w)+1)
text += "_UD"[sign(h)]
print(text)

Submission status: Accepted

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

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

print(U+R+D+L+'LU'+U+R+'RD'+'RD'+D+L+'LU')

Submission status: Accepted

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

ans = ''
for i in range(0, tx-sx):
    ans += 'R'
for i in range(0, ty-sy):
    ans += 'U'
for i in range(0, tx-sx):
    ans += 'L'
for i in range(0, ty-sy):
    ans += 'D'
ans += 'D'
for i in range(0, tx-sx+1):
    ans += 'R'
for i in range(0, ty-sy+1):
    ans += 'U'
ans += 'LU'
for i in range(0, tx-sx+1):
    ans += 'L'
for i in range(0, ty-sy+1):
    ans += 'D'
ans += 'R'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

# 最短経路
route1 = ''
route2 = ''
# 準最短経路
route3 = 'D'
route4 = 'U'
for i in range(tx - sx):
    route1 += 'R'
    route2 += 'L'
    route3 += 'R'
    route4 += 'L'
route3 += 'RU'
route4 += 'LD'

for i in range(ty - sy):
    route1 += 'U'
    route2 += 'D'
    route3 += 'U'
    route4 += 'D'
route3 += 'L'
route4 += 'R'

print(route1 + route2 + route3 + route4)

Submission status: Accepted

Solution code:
def main():
    t = input().split(" ")
    dx = int(t[2]) - int(t[0])
    dy = int(t[3]) - int(t[1])

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

main()

Submission status: Accepted

Solution code:

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

ans = ""

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

print(ans)

Submission status: Accepted

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

x=[]
y=[]

for i in range(c-a):
    x.append("R")
    y.append("L")

for i in range(d-b):
    x.append("U")
    y.append("D")

x2=["D","R"]+x+["U","L"]
y2=["U","L"]+y+["D","R"]

ans=x+y+x2+y2

print(''.join(ans))

Submission status: Accepted

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

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

x = tx - sx
y = ty - sy

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

print(ans)

Submission status: Accepted

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

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

x = tx - sx
y = ty - sy

ans = ""
if x > 0 and y > 0:
    ans += "U"*y + "R"*x + "D"*y + "L"*x
    ans += "L" + "U"*(y+1) + "R"*(x+1) + "D" + "R" + "D"*(y+1) + "L"*(x+1) + "U"
elif x < 0 and y < 0:
    ans += "D"*y + "L"*x + "U"*y + "R"*x
    ans += "R" + "D"*(y+1) + "L"*(x+1) + "U" + "L" + "U"*(y+1) + "R"*(x+1) + "D"
elif x > 0 and y < 0:
    ans += "R"*x + "D"*y + "L"*x + "U"*y
    ans += "U" + "R"*(x+1) + "D"*(y+1) + "L" + "D" + "L"*(x+1) + "U"*(y+1) + "R"
elif x < 0 and y > 0:
    ans += "L"*x + "U"*y + "R"*x + "D"*y
    ans += "D" + "L"*(x+1) + "U"*(y+1) + "R" + "U" + "R"*(x+1) + "D"*(y+1) + "L"

elif x == 0 and y > 0:
    ans += "U"*y + "R" + "D"*y + "L"
    ans += "L" + "U"*y + "R" + "U" + "R"*2 + "D"*(y+2) + "L"*2 + "U"
elif x == 0 and y < 0:
    ans += "D"*y + "L" + "U"*y + "R"
    ans += "R" + "D"*y + "L" + "D" + "L"*2 + "U"*(y+2) + "R"*2 + "D"
elif x > 0 and y == 0:
    ans += "R"*x + "D" + "L"*x + "U"
    ans += "U" + "R"*x + "D" + "R" + "D"*2 + "L"*(x+2) + "U"*2 + "R"
elif x < 0 and y == 0:
    ans += "L"*x + "U" + "R"*x + "D"
    ans += "D" + "L"*x + "U" + "L" + "U"*2 + "R"*(x+2) + "D"*2 + "L"

print(ans)

Submission status: Accepted

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

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

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'

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
sx, sy, tx, ty = [int(i) for i in 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 = [int(_) for _ in input().split(' ')]
dx = tx - sx
dy = ty - sy
answer = 'R' * dx + 'U' * dy + 'L' * dx + 'D' * dy
answer += 'D' + 'R' * (dx + 1) + 'U' * (dy + 1) + 'L'
answer += 'U' + 'L' * (dx + 1) + 'D' * (dy + 1) + 'R'
print(answer)

Submission status: Accepted

Solution code:
sx,sy,tx,ty=map(int,input().split())
x=abs(tx-sx)
y=(ty-sy)
ans=''
for _ in range(x):
    ans=ans+'R'
for _ in range(y):
    ans=ans+'U'
for _ in range(x):
    ans=ans+'L'
for _ in range(y):
    ans=ans+'D'
ans=ans+'L'
for _ in range(y+1):
    ans=ans+'U'
for _ in range(x+1):
    ans=ans+'R'
ans=ans+'DR'
for _ in range(y+1):
    ans=ans+'D'
for _ in range(x+1):
    ans=ans+'L'
ans=ans+'U'
print(ans)

Submission status: Accepted

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

# first go & forth
for i in range(ty) :
    answer.append("U")
for i in range(tx) :
    answer.append("R")
for i in range(ty) :
    answer.append("D")
for i in range(tx) : 
    answer.append("L")

# second go & forth
answer.append("L")

for i in range(ty + 1) :
    answer.append("U")
for i in range(tx + 1) :
    answer.append("R")

answer.append("D")
answer.append("R")

for i in range(ty + 1) :
    answer.append("D")
for i in range(tx + 1) :
    answer.append("L")
answer.append("U")

print("".join(answer))

Submission status: Accepted

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

start = (int(sx), int(sy))
end = (int(tx), int(ty))
l = list()

for _ in range(abs(int(sy)-int(ty))):
	l.append("U")

for _ in range(abs(int(sx)-int(tx))):
	l.append("R")

for _ in range(abs(int(sy)-int(ty))):
	l.append("D")

for _ in range(abs(int(sx)-int(tx))):
	l.append("L")

l.append("L")

for _ in range(abs(int(sy)-int(ty)) + 1):
	l.append("U")

for _ in range(abs(int(sx)-int(tx)) + 1):
	l.append("R")

l.append("DR")

for _ in range(abs(int(sy)-int(ty)) + 1):
	l.append("D")

for _ in range(abs(int(sx)-int(tx)) + 1):
	l.append("L")

l.append("U")

print("".join(l))

Submission status: Accepted

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

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

Submission status: Accepted

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

x = tx-sx
y = ty-sy
str = ""

str += "R"*x+ "U"*y+ "L"*x+ "D"*y+ "L"+ "U"*(y+1)+ "R"*(x+1)+"D"+ "R"+ "D"*(y+1)+ "L"*(x+1)+ "U"

print(str)

Submission status: Accepted

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

# (x,y)のケースで場合分けすればできそう
x = tx-sx
y = ty-sy
str = ""

if(x > 0) and (y > 0):
    #1
    str += "R"*x
    str += "U"*y
    #2
    str += "L"*x
    str += "D"*y
    #3
    str += "L"
    str += "U"*(y+1)
    str += "R"*(x+1)
    str += "D"
    #4
    str += "R"
    str += "D"*(y+1)
    str += "L"*(x+1)
    str += "U"

print(str)

Submission status: Accepted

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

# (x,y)のケースで場合分けすればできそう
x = tx-sx
y = ty-sy
str = ""

if(x > 0) and (y > 0):
    #1
    str += "R"*x
    str += "U"*y
    #2
    str += "L"*x
    str += "D"*y
    #3
    str += "L"
    str += "U"*(y+1)
    str += "R"*(x+1)
    str += "D"
    #4
    str += "R"
    str += "D"*(y+1)
    str += "L"*(x+1)
    str += "U"

elif(x > 0) and (y < 0):
    #1
    str += "R"*x
    str += "D"*y
    #2
    str += "L"*x
    str += "U"*y
    #3
    str += "L"
    str += "D"*(y+1)
    str += "R"*(x+1)
    str += "U"
    #4
    str += "R"
    str += "U"*(y+1)
    str += "L"*(x+1)
    str += "D"

elif(x < 0) and (y > 0):
    #1
    str += "L"*x
    str += "U"*y
    #2
    str += "R"*x
    str += "D"*y
    #3
    str += "R"
    str += "U"*(y+1)
    str += "L"*(x+1)
    str += "D"
    #4
    str += "L"
    str += "D"*(y+1)
    str += "R"*(x+1)
    str += "U"
    
elif(x < 0) and (y < 0):
    #1
    str += "L"*x
    str += "D"*y
    #2
    str += "R"*x
    str += "U"*y
    #3
    str += "R"
    str += "D"*(y+1)
    str += "L"*(x+1)
    str += "U"
    #4
    str += "L"
    str += "U"*(y+1)
    str += "R"*(x+1)
    str += "D"

elif(x==0) and (y < 0):
    #1
    str += "D"*y
    #2
    str += "R"
    str += "U"*y
    str += "L"
    #3
    str += "L"
    str += "D"*y
    str += "R"
    #4
    str += "D"
    str += "LL"
    str += "U"*(y+2)
    str += "RR"
    str += "D"

elif(x==0) and (y > 0):
    #1
    str += "U"*y
    #2
    str += "R"
    str += "D"*y
    str += "L"
    #3
    str += "L"
    str += "U"*y
    str += "R"
    #4
    str += "U"
    str += "LL"
    str += "D"*(y+2)
    str += "RR"
    str += "U"

elif(x > 0) and (y == 0):
    #1
    str += "R"*x
    #2
    str += "U"
    str += "L"*x
    str += "D"
    #3
    str += "D"
    str += "R"*x
    str += "U"
    #4
    str += "R"
    str += "UU"
    str += "L"*(y+2)
    str += "DD"
    str += "R"
    
elif(x < 0) and (y == 0):
    #1
    str += "L"*x
    #2
    str += "U"
    str += "R"*x
    str += "D"
    #3
    str += "D"
    str += "L"*x
    str += "U"
    #4
    str += "L"
    str += "UU"
    str += "R"*(y+2)
    str += "DD"
    str += "L"
    
print(str)

Submission status: Accepted

Solution code:
sx,sy,tx,ty=list(map(int,input().split()))
dx=tx-sx
dy=ty-sy
ans='U'*dy+'R'*dx +'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())
dx = tx-sx
dy = ty-sy
s1 = 'D'+'R'*(dx+1)+'U'*(dy+1)+'L'
s2 = 'U'+'L'*(dx+1)+'D'*(dy+1)+'R'
s3 = 'R'*dx+'U'*dy
s4 = 'L'*dx+'D'*dy
print(s1+s2+s3+s4)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def m():
    sx, sy, tx, ty = map(int, input().split())
    X = tx-sx
    Y = ty-sy
    ans = ""

    # 一周
    ans += "U" * Y
    ans += "R" * X
    ans += "D" * Y
    ans += "L" * X

    # 左に一つずらして目的地まで
    ans += "L"
    ans += "U" * (Y+1)
    ans += "R" * (X+1)
    ans += "D"

    # 右にずれて開始地点まで
    ans += "R"
    ans += "D" * (Y+1)
    ans += "L" * (X+1)
    ans += "U"

    return ans


print(m())

Submission status: Accepted

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

one = ("U"*(ty-sy))+("R"*(tx-sx))
two = ("D"*(ty-sy))+("L"*(tx-sx))
three = "L"+("U"*(ty-sy+1))+("R"*(tx-sx+1))+"D"
four = "R"+("D"*(ty-sy+1))+("L"*(tx-sx+1))+"U"

print(one+two+three+four)

Submission status: Accepted

Solution code:
sx,sy,tx,ty = map(int,input().split())
fx,bx = 'RL' if sx < tx else 'LR'
fy,by = 'UD' if sy < ty else 'DU'
dx,dy = abs(sx-tx),abs(sy-ty)
ans = ''
ans += fy*dy + fx*dx
ans += by*dy + bx*(dx+1)
ans += fy*(dy+1) + fx*(dx+1) + by
ans += fx + by*(dy+1) + bx*(dx+1) + fy
print(ans)

Submission status: Accepted

Solution code:
l = input().split(' ')

y = int(l[3]) - int(l[1])
x = int(l[2]) - int(l[0])

def my_print(i,str):
    for j in range(i):
        print(str,end='')
"""
for i in range(x):
    print('U',end='')

for i in range(y):
    print('R',end='')

for i in range(x):
    print('D',end='')

for i in range(y+1):
    print('L',end='')

for i in range"
"""
my_print(y,'U')
my_print(x,'R')
my_print(y,'D')
my_print(x+1,'L')
my_print(y+1,'U')
my_print(x+1,'R')
my_print(1,'D')
my_print(1,'R')
my_print(y+1,'D')
my_print(x+1,'L')
my_print(1,'U')


print()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
sx,sy,tx,ty=map(int,input().split())

#pattern1,2
str1=""
str2=""
for i in range(abs(tx-sx)):
  str1+="R"
  str2+="L"
for i in range(abs(ty-sy)):
  str1+="U"
  str2+="D"

#pattern3,4
str3="D"
str4="U"
for i in range(abs(tx-sx+1)):
  str3+="R"
  str4+="L"
for i in range(abs(ty-sy+1)):
  str3+="U"
  str4+="D"

str3+="L"
str4+="R"

print("{}{}{}{}".format(str1,str2,str3,str4))

Submission status: Accepted

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

fx,bx = 'L','R'
if sx < tx: fx,bx = bx,fx
fy,by = 'D','U'
if sy < ty: fy,by = by,fy

w = abs(sx-tx)
h = abs(sy-ty)

ans = ''
ans += fy * h
ans += fx * w
ans += by * h
ans += bx * (w+1)
ans += fy * (h+1)
ans += fx * (w+1)
ans += by
ans += fx
ans += by * (h+1)
ans += bx * (w+1)
ans += fy

print(ans)

Submission status: Accepted

Solution code:
x, y, u, v = map(int, input().split())
x=u-x
y=v-y

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

Submission status: Accepted

Solution code:
def main():
    s_x, s_y, t_x, t_y = map(int, input().split())

    dx = t_x - s_x
    dy = t_y - s_y

    way = []
    for i in range(2):
        if i == 1:
            way.append("D")

        for j in range(dx+i):
            way.append("R")
        for j in range(dy+i):
            way.append("U")

        if i == 1:
            way.append("L")
            way.append("U")

        for j in range(dx+i):
            way.append("L")
        for j in range(dy+i):
            way.append("D")

        if i == 1:
            way.append("R")

    print("".join(way))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

a = tx - sx
b = ty - sy

kei = ''
for i in range(a):
    kei = kei + 'R'
    
for i in range(b):
    kei = kei + 'U'
    
for i in range(a):
    kei = kei + 'L'
    
for i in range(b+1):
    kei = kei + 'D'
    
for i in range(a+1):
    kei = kei + 'R'
    
for i in range(b+1):
    kei = kei + 'U'
    
kei = kei + 'LU'

for i in range(a+1):
    kei = kei + 'L'
    
for i in range(b+1):
    kei = kei + 'D'
    
kei = kei + 'R'

print(kei)

Submission status: Accepted

Solution code:
sx,sy,tx,ty=map(int,input().split())
x = abs(tx-sx)
y = abs(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:
x1, y1, x2, y2 = list(map(int, input().split()))

route1 = ["R"] * (x2 - x1) + ["U"] * (y2 - y1)
route2 = ["L"] * (x2 - x1) + ["D"] * (y2 - y1)
route3 = ["D"] + ["R"] * (x2 - x1 + 1) + ["U"] * (y2 - y1 + 1) + ["L"]
route4 = ["U"] + ["L"] * (x2 - x1 + 1) + ["D"] * (y2 - y1 + 1) + ["R"]
route = route1 + route2 + route3 + route4
print("".join(route))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
in1 = list(map(int,input().split()))
x = in1[2]-in1[0]
y = in1[3]-in1[1]
r = ""
for i in range(y):
  r+= "U"
for i in range(x):
  r+= "R"
for i in range(y):
  r+= "D"
for i in range(x):
  r+= "L"
r+= "L"
for i in range(y+1):
  r+= "U"
for i in range(x+1):
  r+= "R"
r+="D"
r+="R"
for i in range(y+1):
  r+= "D"
for i in range(x+1):
  r+= "L"
r+="U"
print(r)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = [0]*2
t = [0]*2
s[0],s[1],t[0],t[1] = map(int,input().split())
ans = 'R'*(t[0]-s[0])+'U'*(t[1]-s[1])+'L'*(t[0]-s[0])+'D'*(t[1]-s[1])+\
'D'+'R'*(t[0]-s[0]+1)+'U'*(t[1]-s[1]+1)+'L'+'U'+'L'*(t[0]-s[0]+1)+'D'*(t[1]-s[1]+1)+'R'
print(ans)

Submission status: Accepted

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

gx = ''
gy = ''
bx = ''
by = ''

for i in range(0, tx-sx):
	gx = gx + 'R'
	bx = bx + 'L'
for i in range(0, ty-sy):
	gy = gy + 'U'
	by = by + 'D'

print gx + gy + bx + by + 'D' + gx + 'RU' + gy + 'LU' + bx + 'LD' + by + 'R'

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from itertools import chain

def main():
    SX, SY, TX, TY = map(int, input().split())

    ud = TY - SY
    lr = TX - SX
    move1 = (('U', ud), ('R', lr))
    move2 = (('D', ud), ('L', lr))
    move3 = (('L', 1), ('U', ud + 1), ('R', lr + 1), ('D', 1))
    move4 = (('R', 1), ('D', ud + 1), ('L', lr + 1), ('U', 1))
    for a, b in chain(move1, move2, move3, move4):
        print(a * b, end='')
    print()

main()

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split(" "))
tx -= sx
ty -= sy
sx = 0
sy = 0
line = []
for i in range(tx):
    line.append("R")
for i in range(ty):
    line.append("U")
for i in range(tx):
    line.append("L")
for i in range(ty):
    line.append("D")
line.append("D")
for i in range(tx+1):
    line.append("R")
for i in range(ty+1):
    line.append("U")
line.append("L")
line.append("U")
for i in range(tx+1):
    line.append("L")
for i in range(ty+1):
    line.append("D")
line.append("R")
for i in range(len(line)):
    if i<len(line):
        print(line[i], end = "")
    else:
        print(line[i])

Submission status: Accepted

Solution code:
sx,sy,tx,ty = list(map(lambda x: int(x), 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 += "D"
route += "R"
route += "D" * (ty-sy+1)
route += "L" * (tx-sx+1)
route += "U"

print(route)

Submission status: Accepted

Solution code:
Sx,Sy,Tx,Ty = map(int,input().split())
Dx,Dy = abs(Tx-Sx),abs(Ty-Sy)
S = ""

moveX,moveY = [],[]
if Dx > 0:
    moveX = ["R","L","R","L"] 
elif Dx < 0:
    moveX = ["L","R","L","R"]
if Dy > 0:
    moveY = ["U","D","U","D"]
elif Dy < 0:
    moveY = ["D","U","D","U"]

S += moveY[0]*Dy + moveX[0]*Dx
S += moveY[1]*Dy + moveX[1]*Dx
S += moveX[1] + moveY[0]*(Dy+1) + moveX[0]*(Dx+1) + moveY[1]
S += moveX[0] + moveY[1]*(Dy+1) + moveX[1]*(Dx+1) + moveY[0]

print(S)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
line = input().split(" ")
sx = int(line[0])
sy = int(line[1])
tx = int(line[2])
ty = int(line[3])

ret = []
# s->t
for _ in range(tx-sx):
    ret.append("R")
for _ in range(ty-sy):
    ret.append("U")

# t->s
for _ in range(tx-sx):
    ret.append("L")
for _ in range(ty-sy):
    ret.append("D")

# s->t
ret.append("D")
for _ in range(tx-sx+1):
    ret.append("R")
for _ in range(ty-sy+1):
    ret.append("U")
ret.append("L")

# t->s
ret.append("U")
for _ in range(tx-sx+1):
    ret.append("L")
for _ in range(ty-sy+1):
    ret.append("D")
ret.append("R")

print("".join(ret))

Submission status: Accepted

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

dx = tx - sx
dy = ty - sy
ans = []
# 1th
for i in range(dy):
    ans.append("U")
for i in range(dx):
    ans.append("R")
# 2nd
for i in range(dy):
    ans.append("D")
for i in range(dx):
    ans.append("L")
# 3rd
ans.append("L")
for i in range(dy+1):
    ans.append("U")
for i in range(dx+1):
    ans.append("R")
ans.append("D")
# 4th
ans.append("R")
for i in range(dy+1):
    ans.append("D")
for i in range(dx+1):
    ans.append("L")
ans.append("U")

print("".join(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())
x = tx - sx
y = ty - sy
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:
sx,sy,tx,ty=map(int,input().split())
x=tx-sx;y=ty-sy
st="U"*y+"R"*x+"D"*y+"L"*(x+1)+"U"*(y+1)+"R"*(x+1)+"D"+"R"+"D"*(y+1)+"L"*(x+1)+"U"
print(st)

Submission status: Accepted

Solution code:
sx,sy,tx,ty = map(int,input().split())
dx, dy = tx-sx, ty-sy
ans = ''
for i in range(2):
    for x in range(dx):
        if i==0:
            ans += 'R'
        else:
            ans += 'L'
    for y in range(dy):
        if i==0:
            ans += 'U'
        else:
            ans += 'D'
for i in range(2):
    if i==0:
        ans += 'L'
    else:
        ans += 'R'
    for y in range(dy+1):
        if i==0:
            ans += 'U'
        else:
            ans += 'D'
    for x in range(dx+1):
        if i==0:
            ans += 'R'
        else:
            ans += 'L'
    if i==0:
        ans += 'D'
    else:
        ans += 'U'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
xy=[int(i) for i in input().split()]
a=abs(xy[2]-xy[0])
b=abs(xy[3]-xy[1])

ans="U"*b+"R"*a+"D"*b+"L"*a+"L"+"U"*(b+1)+"R"*(a+1)+"D"+"R"+"D"*(b+1)+"L"*(a+1)+"U"

print(ans)

Submission status: Accepted

Solution code:

inline = list(map(int,input().split()))
sx = inline[0]
sy = inline[1]
tx = inline[2]
ty = inline[3]

h = sy-ty
w = sx-tx

for i in range(abs(h)):
    if h > 0:
        print("D",end = "")
    else:
        print("U",end="")

for i in range(abs(w)):
    if w > 0:
        print("L",end = "")
    else:
        print("R",end="")

for i in range(abs(h)):
    if h < 0:
        print("D",end = "")
    else:
        print("U",end="")

for i in range(abs(w)):
    if w < 0:
        print("L",end = "")
    else:
        print("R",end="")

if h>0:
    print("U",end="")
else:
    print("D",end="")

for i in range(abs(w)+1):
    if w > 0:
        print("L",end = "")
    else:
        print("R",end="")
for i in range(abs(h)+1):
    if h > 0:
        print("D",end = "")
    else:
        print("U",end="")

if w>0:
    print("R",end="")
else:
    print("L",end="")

if h<0:
    print("U",end="")
else:
    print("D",end="")

for i in range(abs(w)+1):
    if w < 0:
        print("L",end = "")
    else:
        print("R",end="")
for i in range(abs(h)+1):
    if h < 0:
        print("D",end = "")
    else:
        print("U",end="")

if w<0:
    print("R")
else:
    print("L")

Submission status: Accepted

Solution code:
sx,sy,tx,ty = map(int,input().split())
X = tx - sx
Y = ty - sy
# 1往復
ans = "U" * Y + "R" * X
ans += "D" * Y + "L" * X
# 2
ans += "L" + "U" * (Y + 1) + "R" * (X + 1) + "D"
ans += "R" + "D" * (Y + 1) + "L" * (X + 1) + "U"

print(ans)

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)+'LU'+'U'*(ty-sy)+'R'*(tx-sx)+'RDRD'+'D'*(ty-sy)+'L'*(tx-sx)+'LU')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

def main():
    sx,sy,tx,ty = na()
    ret = ""
    for i in range(tx-sx):
        ret += "R"
    for i in range(ty-sy):
        ret += "U"
    for i in range(tx-sx):
        ret += "L"
    for i in range(ty-sy):
        ret += "D"
    ret += "L"
    for i in range(ty-sy+1):
        ret += "U"
    for i in range(tx-sx+1):
        ret += "R"
    ret += "D"
    ret += "R"
    for i in range(ty-sy+1): ret += "D"
    for i in range(tx-sx+1): ret += "L"
    ret += "U"
    print(ret)
    pass


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
sx, sy, tx, ty = [int(x) for x in input().split()]
dx = tx - sx
dy = ty - sy
print('U' * dy + 'R' * dx + 'D' * dy + 'L' * dx + '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())
movelist = ['U','D','L','R']
moved = []
countX = tx - sx
countY = ty - sy

for y in range (0, countY):
    moved.append(movelist[0])

for x in range (0, countX):
    moved.append(movelist[3])

for y in range (0, countY):
    moved.append(movelist[1])

for x in range (0, countX):
    moved.append(movelist[2])

moved.append(movelist[2])

for y in range (0, countY+1):
    moved.append(movelist[0])

for x in range (0, countX+1):
    moved.append(movelist[3])

moved.append(movelist[1])

moved.append(movelist[3])

for y in range (0,countY+1):
    moved.append(movelist[1])

for x in range (0, countX+1):
    moved.append(movelist[2])

moved.append(movelist[0])

print("".join(moved))

Submission status: Accepted

Solution code:
# coding: utf-8
s=''
sx,sy,tx,ty=map(int,input().split())
for i in range(tx-sx):
    s+='R'
for i in range(ty-sy):
    s+='U'
for i in range(tx-sx):
    s+='L'
for i in range(ty-sy):
    s+='D'
s+='D'
for i in range(tx-sx+1):
    s+='R'
for i in range(ty-sy+1):
    s+='U'
s+='LU'
for i in range(tx-sx+1):
    s+='L'
for i in range(ty-sy+1):
    s+='D'
s+='R'
print(s)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())
a = ''
x = tx - sx
y = ty - sy
for i in range(y):
    a+='U'
    
for i in range(x):
    a+='R'

for i in range(y):
    a+='D'

for i in range(x+1):
    a+='L'

for i in range(y+1):
    a+='U'

for i in range(x+1):
    a+='R'

a+='D'
a+='R'
for i in range(y+1):
    a+='D'

for i in range(x+1):
    a+='L'

a+='U'
print(a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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