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

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

hight = ty - sy
width = tx - sx

res = ''

res += 'U' * hight
res += 'R' * width
res += 'D' * hight
res += 'L' * width
res += 'L'
res += 'U' * (hight + 1)
res += 'R' * (width + 1)
res += 'DR'
res += 'D' * (hight + 1)
res += 'L' * (width + 1)
res += 'U'

print(res)

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

Solution (Python):
(sx, sy, tx, ty) = [int(i) for i in input().split(" ")]
dx = tx - sx
dy = ty - sy

s  = ""

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


s += "L"*dx
s += "D"*dy


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


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

print(s)

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

    root = ""

    
    for n in range(tx - sx):
        root += "R"
    for n in range(ty - sy):
        root += "U"

    
    for n in range(tx - sx):
        root += "L"
    for n in range(ty - sy):
        root += "D"

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

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

    print(root)

if __name__ == "__main__":
    main()

Solution (Python):
sx,sy,tx,ty=map(int,input().split())
dx,dy=tx-sx,ty-sy
s1='U'*dy+'R'*dx+'D'*dy+'L'*dx
s2='LU'+'U'*dy+'R'*dx+'RD'+'RD'+'D'*dy+'L'*dx+'LU'
print(s1+s2)

Solution (Python):

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

dir_x = ["", "R", "L"]
dir_y = ["", "U", "D"]

dx = 1 if (tx - sx > 0) else -1
dy = 1 if (ty - sy > 0) else -1

ans += dir_x[dx] * abs(tx - sx)
ans += dir_y[dy] * abs(ty - sy)

ans += dir_x[-dx] * abs(tx - sx)
ans += dir_y[-dy] * abs(ty - sy)

ans += dir_y[-dy]
ans += dir_x[dx] * (abs(tx - sx) + 1)
ans += dir_y[dy] * (abs(ty - sy) + 1)
ans += dir_x[-dx]

ans += dir_y[dy]
ans += dir_x[-dx] * (abs(tx - sx) + 1)
ans += dir_y[-dx] * (abs(ty - sy) + 1)
ans += dir_x[dx]

print(ans)

Solution (Python):
sx, sy, tx, ty = map(int, input().split())
dx = tx - sx
dy = ty - sy
if dx >= 0:
	if dy >= 0:
		ans = "U"*dy + "R"*dx + "D"*dy + "L"*(dx+1) + "U"*(dy+1) + "R"*(dx+1) + "D" + "R" + "D"*(dy+1) + "L"*(dx+1) + "U"
	else:
		ans = "D"*dy + "R"*dx + "U"*dy + "L"*(dx+1) + "D"*(dy+1) + "R"*(dx+1) + "U" + "R" + "U"*(dy+1) + "L"*(dx+1) + "D"
else:
	if dy >= 0:
		ans = "U"*dy + "L"*dx + "D"*dy + "R"*(dx+1) + "U"*(dy+1) + "L"*(dx+1) + "D" + "L" + "D"*(dy+1) + "R"*(dx+1) + "U"
	else:
		ans = "D"*dy + "L"*dx + "U"*dy + "R"*(dx+1) + "D"*(dy+1) + "L"*(dx+1) + "U" + "L" + "U"*(dy+1) + "R"*(dx+1) + "D"
print(ans)

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

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

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

print(ans)

Solution (Python):
sx, sy, tx, ty = map(int, input().split())
w, h = tx-sx+1, ty-sy+1

print('U'*(h-1) + 'R'*w + 'D'*h + 'L'*w + 'UL' + 'U'*h + 'R'*w + 'D'*h + 'L'*(w-1))

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

w = tx - sx
h = ty - sy

c = "U" * h + "R" * (w + 1) + "D" * (h + 1) + "L" * w
print c + "LULU" + c

Solution (Python):



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"
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)

Solution (Python):
import sys
(sx, sy, tx, ty) = map(int, raw_input().split())

dx, dy = tx - sx, ty - sy


for i in xrange(dy):
    sys.stdout.write('U')
for i in xrange(dx):
    sys.stdout.write('R')
    


for i in xrange(dy):
    sys.stdout.write('D')
for i in xrange(dx):
    sys.stdout.write('L')




sys.stdout.write('L')

for i in xrange(dy + 1):
    sys.stdout.write('U')
for i in xrange(dx + 1):
    sys.stdout.write('R')
    
sys.stdout.write('D')


sys.stdout.write('R')

for i in xrange(dy + 1):
    sys.stdout.write('D')
for i in xrange(dx + 1):
    sys.stdout.write('L')
    
sys.stdout.write('U')
sys.stdout.write('\n')

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

aa = c-a
bb = d-b
ans = ''
for i in range(bb):
	ans = ans + 'U'
for i in range(aa):
	ans = ans + 'R'
for i in range(bb):
	ans = ans + 'D'
for i in range(aa):
	ans = ans + 'L'

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

print(ans)

Solution (Python):
sx, sy, tx, ty = tuple(int(x) for x in input().split())

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

print(ans)

Solution (Python):
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)

Solution (Python):
sx, sy, tx, ty = [int(i) for i in input().split()]
dx = tx - sx
dy = ty - sy
print(''.join(("U" * dy, "R" * dx,
         "D" * dy, "L" * dx,
         "L", "U", "U" * dy, "R", "R" * dx, "D",
         "R", "D", "D" * dy, "L", "L" * dx, "U")))

Solution (Python):
sx,sy,tx,ty=map(int,raw_input().split())
dx=tx-ty;dy=ty-sy
ans=[]
for i in xrange(sx,tx):
    ans.append("R")
for i in xrange(sy,ty):
    ans.append("U")
for i in xrange(sx,tx):
    ans.append("L")
for i in xrange(sy,ty):
    ans.append("D")
ans.append("D")
for i in xrange(sx,tx+1):
    ans.append("R")
for i in xrange(sy,ty+1):
    ans.append("U")
ans.append("L")
ans.append("U")
for i in xrange(sx,tx+1):
    ans.append("L")
for i in xrange(sy,ty+1):
    ans.append("D")
ans.append("R")
print("".join(ans))

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

ans1 = 'R'*tx + 'U'*ty + 'L'*tx + 'D'*ty

ans2 = 'D' + 'R'*(tx+1) + 'U'*(ty+1) + 'L'

ans3 = 'U' + 'L'*(tx+1) + 'D'*(ty+1) + 'R'

print ans1 + ans2 + ans3

Solution (Python):


import sys
stdin = sys.stdin
def na(): return map(int, stdin.readline().split())
def ns(): return stdin.readline().strip()

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 += "D"
    for i in range(tx-sx+1):
        ret += "R"
    for i in range(ty-sy+1):
        ret +="U"
    ret += "L"
    ret += "U"
    for i in range(tx-sx+1): ret += "L"
    for i in range(ty-sy+1): ret += "D"
    ret += "R"
    print(ret)
    pass


if __name__ == '__main__':
    main()