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 = list(map(int, input().split()))

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

print(result)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())
ans = ''
ans += 'U' * (ty - sy)  # 1
ans += 'R' * (tx - sx)  # 2
ans += 'D' * (ty - sy)  # 3
ans += 'L' * (tx - sx + 1)  # 4
ans += 'U' * (ty - sy + 1)  # 5
ans += 'R' * (tx - sx + 1)  # 6
ans += 'DR'  # 7, 8
ans += 'D' * (ty - sy + 1)  # 9
ans += 'L' * (tx - sx + 1)  # 10
ans += 'U'  # 11
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

dx = tx - sx
dy = ty - sy

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

Submission status: Accepted

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


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

# 2nd round
PATH += "D"
for i in range(tx+1-sx):
    PATH += "R"
for i in range(ty - sy + 1):
    PATH += "U"

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

Submission status: Accepted

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

ans = ''
if sx <= tx and sy <= ty:
    ans += 'R'*abs(sx-tx) + 'U'*abs(sy-ty) + 'L'*abs(sx-tx) + 'D'*abs(sy-ty)
    ans += 'L' + 'U'*(abs(ty-sy)+1) + 'R'*(abs(tx-sx)+1) + 'D'
    ans += 'R' + 'D'*(abs(ty-sy)+1) + 'L'*(abs(tx-sx)+1) + 'U'
    print(ans)
elif sx > tx and sy <= ty:
    ans += 'L'*abs(sx-tx) + 'U'*abs(sy-ty) + 'R'*abs(sx-tx) + 'D'*abs(sy-ty)
    ans += 'R' + 'U'*(abs(ty-sy)+1) + 'L'*(abs(tx-sx)+1) + 'D'
    ans += 'L' + 'D'*(abs(ty-sy)+1) + 'R'*(abs(tx-sx)+1) + 'U'
    print(ans)
elif sx > tx and sy > ty:
    ans += 'L'*abs(sx-tx) + 'D'*abs(sy-ty) + 'R'*abs(sx-tx) + 'U'*abs(sy-ty)
    ans += 'R' + 'D'*(abs(ty-sy)+1) + 'L'*(abs(tx-sx)+1) + 'U'
    ans += 'L' + 'U'*(abs(ty-sy)+1) + 'R'*(abs(tx-sx)+1) + 'D'
    print(ans)
elif sx <= tx and sy > ty:
    ans += 'R'*abs(sx-tx) + 'D'*abs(sy-ty) + 'L'*abs(sx-tx) + 'U'*abs(sy-ty)
    ans += 'L' + 'D'*(abs(ty-sy)+1) + 'R'*(abs(tx-sx)+1) + 'U'
    ans += 'R' + 'U'*(abs(ty-sy)+1) + 'L'*(abs(tx-sx)+1) + 'D'
    print(ans)

Submission status: Accepted

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

x = tx-sx
y = ty-sy

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

Submission status: Accepted

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

xdist = abs(tx - sx)
ydist = abs(ty - sy)

rt1 = "U" * ydist + "R" * xdist
rt2 = "D" * ydist + "L" * xdist
rt3 = "L" + "U" * (ydist + 1) + "R" * (xdist + 1) + "D"
rt4 = "R" + "D" * (ydist + 1) + "L" * (xdist + 1) + "U"
print(rt1 + rt2 + rt3 + rt4)

Submission status: Accepted

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

ans = ""

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

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

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

Submission status: Accepted

Solution code:
x,y,tx,ty = list(map(int, input().split()))

dx = tx-x
dy = ty-y

ans=''

for i in range(dx):
    ans+='R'
for i in range(dy):
    ans+='U'
for i in range(dx):
    ans+='L'
for i in range(dy):
    ans+='D'
ans+='D'
for i in range(dx+1):
    ans+='R'
for i in range(dy+1):
    ans+='U'
ans+='L'
ans+='U'
for i in range(dx+1):
    ans+='L'
for i in range(dy+1):
    ans+='D'
ans+='R'

print(ans)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = (int(i) for i in input().split())
w = tx-sx
h = ty-sy

res = "U"*h+"R"*w+"D"*h+"L"*(w+1)+"U"*(h+1)+"R"*(w+1)+"DR"+"D"*(h+1)+"L"*(w+1)+"U"
print(res)

Submission status: Accepted

Solution code:
Sx,Sy,Tx,Ty=[int(i) for i in input().split()]
x,y=[Tx-Sx,Ty-Sy]
if y>0:
    U="U"
    D="D"
else:
    U="D"
    D="U"
if x>0:
    R="R"
    L="L"
else:
    R="L"
    L="R"
x=abs(x)
y=abs(y)
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:
sx,sy,tx,ty=map(int,input().split())
tx-=sx
ty-=sy
ans=""
ans+="R"*tx+"U"*ty
ans+="L"*tx+"D"*ty
ans+="D"+"R"*(tx+1)+"U"*(ty+1)+"L"
ans+="U"+"L"*(tx+1)+"D"*(ty+1)+"R"
print(ans)

Submission status: Accepted

Solution code:
sx,sy,tx,ty=map(int,input().split(' '))
r1='R'*(tx-sx)
r2='U'*(ty-sy)
r3='L'*(tx-sx)
r4='D'*(ty-sy)
r=r1+r2+r3+r4+'D'+r1+'RU'+r2+'L'+'U'+r3+'LD'+r4+'R'
print(r)

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

print(res)

Submission status: Accepted

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

def main():
	sx, sy, tx, ty = map(int, input().split(" "))
	
	ans = []
	
	# 1往復目
	for _ in range(sx, tx):
		ans.append("R")
	for _ in range(sy, ty):
		ans.append("U")
	for _ in range(tx, sx, -1):
		ans.append("L")
	for _ in range(ty, sy, -1):
		ans.append("D")
		
	# 2往復目
	ans.append("D")
	for _ in range(sx, tx+1):
		ans.append("R")
	for _ in range(sy-1, ty):
		ans.append("U")
	ans.append("L")
	
	ans.append("U")
	for _ in range(tx, sx-1, -1):
		ans.append("L")
	for _ in range(ty+1, sy, -1):
		ans.append("D")
	ans.append("R")
	
	print("".join(ans))
	
if __name__ == "__main__":
	main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def print_repeat(time, word):
    for n in range(0, time):
        print("{}".format(word), end="")


sx,sy,tx,ty = map(int, input().split())
S = abs(sy-ty)
T = abs(sx-tx)
print_repeat(S,'U')
print_repeat(T,'R')
print_repeat(S,'D')
print_repeat(T+1,'L')
print_repeat(S+1,'U')
print_repeat(T+1, 'R')
print_repeat(1, 'D')
print_repeat(1, 'R')
print_repeat(S+1,'D')
print_repeat(T+1,'L')
print_repeat(1,'U')

Submission status: Accepted

Solution code:
def int_raw():
    return int(raw_input())

def ss_raw():
    return raw_input().split()

def ints_raw():
    return map(int,ss_raw())

sx,sy,tx,ty = ints_raw()
dx = tx-sx
dy = ty-sy


f1st = "U"*dy + "R"*dx
b1st = "D"*dy + "L"*dx
f2nd = "L" + "U"*(dy+1) + "R"*(dx+1) + "D"
b2nd = "R" + "D"*(dy+1) + "L"*(dx+1) + "U"

print f1st+b1st+f2nd+b2nd

Submission status: Accepted

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

Submission status: Accepted

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

dx=tx-sx
dy=ty-sy

result=[]
for i in range(dx):
  result.append("R")
for i in range(dy):
  result.append("U")
for i in range(dx):
  result.append("L")
for i in range(dy):
  result.append("D")

result.append("D")  
for i in range(dx+1):
  result.append("R")
for i in range(dy+1):
  result.append("U")
result.append("L")

result.append("U")
for i in range(dx+1):
  result.append("L")
for i in range(dy+1):
  result.append("D")
result.append("R")


print("".join(result))

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)+"LU"+"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
ans = 'R' * x + 'U' * y + 'L' * x + 'D' * y + 'D' + 'R' * (x + 1) + 'U' * (y + 1) \
    + 'L' + 'U' + 'L' * (x + 1) + 'D' * (y + 1) + 'R'

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

    print(''.join(solve(sx, sy, tx, ty)))

def solve(sx, sy, tx, ty):
    for s in vertical(sx, sy, tx, ty): yield s
    for s in vertical(tx, ty, sx, sy): yield s
    yield 'L'
    for s in vertical(sx - 1, sy, tx, ty + 1): yield s
    yield 'D'
    yield 'R'
    for s in vertical(tx + 1, ty, sx, sy - 1): yield s
    yield 'U'

def vertical(sx, sy, tx, ty):
    yield move(ty - sy, 'U', 'D')
    yield move(tx - sx, 'R', 'L')

def move(q, up, down):
    if q > 0:
        return up * q
    else:
        return down * (-q)

main()

Submission status: Accepted

Solution code:
sx, sy, tx, ty = list(map(int, input().split()))
dx = tx - sx
dy = ty - sy
ans1 = ans2 = ''
table = ans1.maketrans({'U': 'D', 'D': 'U', 'L': 'R', 'R': 'L'})

# 1往復
if dx > 0:
    ans1 += 'R' * abs(dx)
else:
    ans1 += 'L' * abs(dx)

if dy > 0:
    ans1 += 'U' * abs(dy)
else:
    ans1 += 'D' * abs(dy)

ans1 += ans1.translate(table)

# 2往復
if dx > 0 and dy > 0:
    ans2 += 'D' + 'R' * (abs(dx) + 1) + 'U' * (abs(dy) + 1) + 'L'
elif dx < 0 and dy > 0:
    ans2 += 'R' + 'U' * (abs(dx) + 1) + 'L' * (abs(dy) + 1) + 'D'
elif dx < 0 and dy < 0:
    ans2 += 'U' + 'L' * (abs(dx) + 1) + 'D' * (abs(dy) + 1) + 'R'
elif dx > 0 and dy < 0:
    ans2 += 'L' + 'D' * (abs(dx) + 1) + 'R' * (abs(dy) + 1) + 'U'

ans2 += ans2.translate(table)

print(ans1+ans2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
sx,sy,tx,ty = map(int,input().split())
diff_x=tx-sx
diff_y=ty-sy
ans = ''
for i in range(diff_y):
    ans += 'U'
for i in range(diff_x):
    ans += 'R'
for i in range(diff_y):
    ans += 'D'
for i in range(diff_x):
    ans += 'L'
ans += 'L'
for i in range(diff_y+1):
    ans += 'U'
for i in range(diff_x+1):
    ans += 'R'
ans += 'DR'
for i in range(diff_y+1):
    ans += 'D'
for i in range(diff_x+1):
    ans += 'L'
ans += 'U'

print(ans)

Submission status: Accepted

Solution code:
sx,sy,gx,gy=map(int,input().split())
dx,dy=gx-sx,gy-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())
x = abs(tx - sx)
y = abs(ty - sy)
U, D, L, R = 'U', 'D', 'L', 'R'

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

Submission status: Accepted

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

    dx, dy = tx - sx, ty - sy

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
sx,sy,tx,ty=map(int,input().split())
ans=""
for u in range(ty-sy):
    ans+="U"
for r in range(tx-sx):
    ans+="R"
for d in range(ty-sy):
    ans+="D"
for l in range(tx-sx):
    ans+="L"
ans+="L"
for u in range(ty-sy+1):
    ans+="U"
for r in range(tx-sx+1):
    ans+="R"
ans+="DR"
for d 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:
import sys
write = sys.stdout.write

temp = list(map(int,input().split()))
sx = temp[0]
sy = temp[1]
tx = temp[2]
ty = temp[3]
H = ty - sy
W = tx - sx
for i in range(H):
    write("U")
for i in range(W):
    write("R")
for i in range(H):
    write("D")
for i in range(W+1):
    write("L")
for i in range(H+1):
    write("U")
for i in range(W+1):
    write("R")
write("D")
write("R")
for i in range(H+1):
    write("D")
for i in range(W+1):
    write("L")
write("U\n")

Submission status: Accepted

Solution code:
x1,y1,x2,y2 = map(int,input().split())
tate = abs(y1-y2)
yoko = abs(x1-x2)

print("U"*tate+"R"*yoko+"D"*tate+"L"*yoko,end="")
print("L"+"U"*(tate+1)+"R"*(yoko+1)+"D"+"R"+"D"*(tate+1)+"L"*(yoko+1)+"U")

Submission status: Accepted

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

Submission status: Accepted

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

result = ''

# 1syuume
result += 'R'*abs(sx-tx)
result += 'U'*abs(sy-ty)
result += 'L'*abs(sx-tx)
result += 'D'*abs(sy-ty)

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

print(result)

Submission status: Accepted

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
sx,sy,tx,ty = map(int, input().split())

ans = ""

#UP
ans += "U" * (ty-sy)
ans += "R" * (tx-sx)
ans += "D" * (ty-sy)
ans += "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().split())
dx = tx - sx
dy = ty - sy
a = 'R'*dx + 'U'*dy
b = a.replace('R','L').replace('U','D')
c = 'L' + 'U'*(dy+1) + 'R'*(dx+1) + 'D'
d = 'R' + 'D'*(dy+1) + 'L'*(dx+1) + 'U'
print(a+b+c+d)

Submission status: Accepted

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

res = ''
if tx - sx < 0:
    res += abs(tx - sx) * 'L'
else:
    res += abs(tx - sx) * 'R'

if ty - sy < 0:
    res += abs(ty - sy) * 'D'
else:
    res += abs(ty - sy) * 'U'
    
N = len(res)
tmp1 = res
tmp2 = ''
for i in range(N):
    if res[i] == 'U':
        tmp2 += 'D'
    if res[i] == 'D':
        tmp2 += 'U'
    if res[i] == 'R':
        tmp2 += 'L'
    if res[i] == 'L':
        tmp2 += 'R'
  
res = tmp1 + tmp2
tmp3 = ''
for i in range(N-1):
    if tmp1[i] != tmp1[i+1]:
        tmp3 = tmp1[:i] +tmp1[i] + tmp1[i:]
    
tmp3 = tmp2[-1] + tmp3 + tmp3[-1] + tmp2[0]     
res = res + tmp3 

N = len(tmp3)
tmp4 = ''
for i in range(N):
    if tmp3[i] == 'U':
        tmp4 += 'D'
    if tmp3[i] == 'D':
        tmp4 += 'U'
    if tmp3[i] == 'R':
        tmp4 += 'L'
    if tmp3[i] == 'L':
        tmp4 += 'R'    
        
res = res + tmp4

print(res)

Submission status: Accepted

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

Submission status: Accepted

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

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+1) + "R"*(x+1) + "U"*(y+1) + "LU" + "L"*(x+1) + "D"*(y+1) + "R")

Submission status: Accepted

Solution code:
sx,sy,tx,ty=map(int,input().split())
u=tx-sx
r=ty-sy
r1=''
for i in range(r):
  r1+='U'
for j in range(u):
  r1+='R'
r2=r1.replace('U','D').replace('R','L')
r3='LU'+r1+'RD'
r4='RD'+r2+'LU'
print(r1+r2+r3+r4)

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:
inputs = list(map(int, input().split()))
S=[inputs[x] for x in range(2)]
G=[inputs[x] for x in range(2,4)]
Dx=G[0]-S[0]
Dy=G[1]-S[1]
r1='R'*Dx+'U'*Dy
r2='L'*Dx+'D'*Dy
r3='L'+'U'*(Dy+1)+'R'*(Dx+1)+'D'
r4='R'+'D'*(Dy+1)+'L'*(Dx+1)+'U'
print(r1+r2+r3+r4)

Submission status: Accepted

Solution code:
inputs = list(map(int, input().split()))
S = [inputs[x] for x in range(2)]
G = [inputs[x] for x in range(2,4)]
Dx = G[0] - S[0]
Dy = G[1] - S[1]
r1 = 'R'*Dx + 'U'*Dy
r2 = 'L'*Dx + 'D'*Dy
r3 = 'L'+'U'*(Dy + 1) + 'R'*(Dx+1)+'D'
r4 = 'R'+'D'*(Dy + 1) + 'L'*(Dx+1)+'U'
print(r1+r2+r3+r4)

Submission status: Accepted

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

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 + "L" + "U"*(Y+1) + "R"*(X+1) + "DR" +"D"*(Y+1) + "L"*(X+1) + "U")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import os
import math
INF, MOD = float("inf"), 1e9 + 7
MAX, MIN = -INF, INF
dx1, dy1, dx2, dy2 = [-1, 0, 1, 0], [0, -1, 0, 1], [-1, 0, 1, -1, 1, -1, 0, 1], [-1, -1, -1, 0, 0, 1, 1, 1]

def get_int():
    return int(input())

def get_int_list():
    return list(map(int, input().split()))

while(True):
    try:
        a, b, x, y = get_int_list()
        print('R' * (x - a) + 'U' * (y - b) + 'L' * (x - a) + 'D' * (y - b) + 'D' + 'R' * (x - a + 1) + 'U' * (y - b + 1) + "LU" + 'L' * (x - a + 1) + 'D' * (y - b + 1) + 'R')
    except EOFError:
        exit()

Submission status: Accepted

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

# go first time
for i in range(h):
    ans += "U"

for i in range(w):
    ans += "R"

# back first time
for i in range(h):
    ans += "D"

for i in range(w):
    ans += "L"

# go second time
ans += "L"
for i in range(h + 1):
    ans += "U"

for i in range(w + 1):
    ans += "R"
ans += "D"

# back second time
ans += "R"
for i in range(h + 1):
    ans += "D"

for i in range(w + 1):
    ans += "L"
ans += "U"

print(ans)

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
ans=dy*'U'+dx*'R'+dy*'D'+dx*'L'+'L'+(dy+1)*'U'+(dx+1)*'R'+'D'+'R'+(dy+1)*'D'+(dx+1)*'L'+'U'
print(ans)

Submission status: Accepted

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

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

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 += 'DR'
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 = map(int, input().split())
x, y = tx-sx, ty-sy
print('R'*x + 'U'*y + 'L'*x + 'D'*y
      + 'D' + 'R'*(x+1) + 'U'*(y+1) + 'L' + 'U' + 'L'*(x+1) + 'D'*(y+1) + 'R')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())
y = abs(ty - sy)
x = abs(tx - sx)
r1 = y * 'U' + x * 'R'
r2 = y * 'D' + x * 'L'
r3 = 'L' + (y + 1) * 'U' + (x + 1) * 'R' + 'D'
r4 = 'R' + (y + 1) * 'D' + (x + 1) * 'L' + 'U'

print(r1 + r2 + r3 + r4)

Submission status: Accepted

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

Submission status: Accepted

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

ans = ''
ans += x * 'R'
ans += y * 'U'
ans += x * 'L'
ans += y * 'D'
# 2
x += 1
y += 1
ans += 'D'
ans += x * 'R'
ans += y * 'U'
ans += 'LU'
ans += x * 'L'
ans += y * 'D'
ans += 'R'

print(ans)

Submission status: Accepted

Solution code:
a,b,x,y = (int(i) for i in input().split())
width = x-a
height = y-b
keiro1= 'L'+'U'*(height+1)+'R'*(width+1)+'D'
keiro2= 'L'*width+'D'*height
keiro3= 'R'*width+'U'*height
keiro4= 'R'+'D'*(height+1)+'L'*(width+1)+'U'
ans = keiro1+ keiro2+keiro3+keiro4


print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

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

main()

Submission status: Accepted

Solution code:
a, b, c, d = list(map(int, input().split()))
pos1 = [a, b]
pos2 = [c, d]

ans = ''


def horizontal(xdiff, ydiff):
    ret = ''
    ret += 'R'*xdiff + 'U'*ydiff
    ret += 'L'*xdiff + 'D'*ydiff
    ret += 'D'+'R'*(1+xdiff)+'U'*(1+ydiff)+'L'
    ret += 'U'+'L'*(1+xdiff)+'D'*(1+ydiff)+'R'
    return ret


ans = horizontal(c-a, d-b)
print(ans)

Submission status: Accepted

Solution code:
import sys
sx, sy, tx, ty = [int(n) for n in input().split()]
W = tx - sx
H = ty-sy
r1 = "U"*H + "R"*W
r2 = "D"*H + "L"*W
r3 = "D" + "R"*W + "R" + "U"*H + "U" + "L"
r4 = "U" + "L"*W + "L" + "D"*H + "D" + "R"
print(r1 + r2 + r3 + r4)

Submission status: Accepted

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

rap_1 = abs(ty-sy) * ['U'] + abs(tx-sx) * ['R']
rap_1 += abs(ty-sy) * ['D'] + abs(tx-sx) * ['L']
rap_2 = ['L'] + (abs(ty-sy)+1) * ['U'] + (abs(tx-sx)+1) * ['R'] + ['D']
rap_2 += ['R'] + (abs(ty-sy)+1) * ['D'] + (abs(tx-sx)+1) * ['L'] + ['U']

print(''.join(rap_1)+''.join(rap_2))

Submission status: Accepted

Solution code:
a,b,c,d=map(int,input().split())
for i in range(c-a):
  print('R',end='')
for j in range(d-b):
  print('U',end='')
for i in range(c-a):
  print('L',end='')
for j in range(d-b):
  print('D',end='')
print('D',end='')
for k in range(c-a+1):
  print('R',end='')
for l in range(d-b+1):
  print('U',end='')
print('L',end='')
print('U',end='')
for k in range(c-a+1):
  print('L',end='')
for l in range(d-b+1):
  print('D',end='')
print('R')

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:
a,b,c,d=map(int,input().split())
print("R"*(c-a)+"U"*(d-b)+"L"*(c-a)+"D"*(d-b)+"L"+"U"*(d-b+1)+"R"*(c-a+1)+"D"+"R"+"D"*(d-b+1)+"L"*(c-a+1)+"U")

Submission status: Accepted

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

r = []
# 1
r.append("U" * (ty - sy))
r.append("R" * (tx - sx))
# 2
r.append("D" * (ty - sy))
r.append("L" * (tx - sx))
# 3
r.append("L")
r.append("U" * (ty - sy + 1))
r.append("R" * (tx - sx + 1))
r.append("D")
# 4
r.append("R")
r.append("D" * (ty - sy + 1))
r.append("L" * (tx - sx + 1))
r.append("U")

print("".join(r))

Submission status: Accepted

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

w = tx - sx
h = ty - sy

loop1 = 'U' * h + 'R' * w + 'D' * h + 'L' * w
loop2 = 'L' + 'U' * (h+1) + 'R' * (w+1) + 'D' + 'R' + 'D' * (h+1) + 'L' * (w+1) + 'U'
print(loop1 + loop2)

Submission status: Accepted

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

Submission status: Accepted

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

dx = tx - sx
dy = ty - sy
ans = ""
# first turn
ans += "R" * dx
ans += "U" * dy
ans += "L" * dx
ans += "D" * dy
# second turn
ans += "D"
ans += "R" * (dx+1)
ans += "U" * (dy+1)
ans += "L"

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

Submission status: Accepted

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

    dx = tx - sx
    dy = ty - sy

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

    return ans


def main():
    ans = solve()
    print(ans)


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 + "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:
def up_right(x,y):
    s = ""
    for i in range(y):
        s += 'U'
    for i in range(x):
        s += 'R'
    return s
def left_down(x,y):
    s = ""
    for i in range(y):
        s += 'D'
    for i in range(x):
        s += 'L'
    return s

sx,sy,tx,ty = map(int,input().split())
xdis = tx - sx
ydis = ty - sy
ans1 = ""
ans2 = ""
ans1 = up_right(xdis,ydis) + left_down(xdis,ydis)
ans2 = 'L' + up_right(xdis+1,ydis+1) + 'D' + 'R' + left_down(xdis+1,ydis+1) +'U'
print(ans1+ans2)

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(abs(ty-sy)):
	ans.append("U")
for i in range(abs(tx-sx)):
	ans.append("R")
for i in range(abs(ty-sy)):
	ans.append("D")
for i in range(abs(tx-sx)):
	ans.append("L")

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

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

print(''.join(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 = map(int, input().split())
ans = ""
dif_y = ty-sy
dif_x = tx-sx
ans += "U" * dif_y
ans += "R" * dif_x
ans += "D" * dif_y
ans += "L" * dif_x
ans += "L"
ans += "U" * (dif_y+1)
ans += "R" * (dif_x+1)
ans += "D"
ans += "R"
ans += "D" * (dif_y+1)
ans += "L" * (dif_x+1)
ans += "U"
print(ans)

Submission status: Accepted

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