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

x = tx-sx
y = ty-sy

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

print(ans)

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

Solution (Python):
S = [0,0]
T = [0,0]

S[0],S[1],T[0],T[1]= map(int,input().split())

del_x = T[0] - S[0]
del_y = T[1] - S[1]

ans = ''

ans = 'R'*del_x + 'U'*del_y + 'L'*del_x + 'D'*del_y

ans = ans + 'D' + 'R'*(del_x+1) + 'U'*(del_y+1) + 'L'

ans = ans + 'U' + 'L'*(del_x+1) + 'D'*(del_y+1) + 'R'
print(ans)

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

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

print(path)

Solution (Python):



"""
    −1000≦sx<tx≦1000
    −1000≦sy<ty≦1000
    sx,sy,tx,ty
    は整数である。
"""

test_mode = False

sx, sy, tx, ty = map(int, input().split())
dx = tx - sx
dy = ty - sy
abs_dx = abs(dx)
abs_dy = abs(dy)

if test_mode:
    print('dx = {}'.format(dx))
    print('dy = {}'.format(dy))
    print('abs_dx = {}'.format(abs_dx))
    print('abs_dy = {}'.format(abs_dy))


def course_type(x, y):
    """
    x, y について
        0: x,y 両方が でない
        1: x   だけが 0
        2: y   だけが 0
        3: x,y 両方が 0
    を返す。入力は絶対値でよろしく。
    """
    if x != 0 and y != 0:
        return 0
    if x == 0 and y != 0:
        return 1
    if x != 0 and y == 0:
        return 2
    return 3


def course_temp(x, y):
    """
    とりあえず (0, 0)→(x, y) の2往復のしかたを返す関数。
    x,y >= 0 とすること。※第1象限で考えるため
    """

    s = ''
    flag = course_type(x, y)

    if flag == 0: 
        
        for _ in range(x):
            s += 'R'
        for _ in range(y+1):
            s += 'U'
        for _ in range(x+1):
            s += 'L'
        for _ in range(y+1):
            s += 'D'
        s += 'R'
        
        
        s += 'D'
        for _ in range(x+1):
            s += 'R'
        for _ in range(y+1):
            s += 'U'
        for _ in range(x+1):
            s += 'L'
        for _ in range(y):
            s += 'D'
        

    elif flag == 1:
        
        for _ in range(y+1):
            s += 'U'
        s += 'L'
        s += 'L'
        for _ in range(y+2):
            s += 'D'
        s += 'R'
        s += 'R'
        s += 'U'
        
        
        s += 'R'
        for _ in range(y):
            s += 'U'
        s += 'L'
        s += 'L'
        for _ in range(y):
            s += 'D'
        s += 'R'
        

    elif flag == 2:
        
        for _ in range(y+1):
            s += 'R'
        s += 'U'
        s += 'U'
        for _ in range(y+2):
            s += 'L'
        s += 'D'
        s += 'D'
        s += 'R'
        
        
        s += 'D'
        for _ in range(y):
            s += 'R'
        s += 'U'
        s += 'U'
        for _ in range(y):
            s += 'L'
        s += 'D'
        

    else:
        pass

    return s


def convert(s):
    """
    dx, dy の符号に応じて 文字列s を変換して返す関数
    """
    if dx >= 0:
        pass
    else:
        s.translate(str.maketrans('RL', 'LR', )) 
    if dy >= 0:
        pass
    else:
        s.translate(str.maketrans('UD', 'DU', )) 

    return s


def main():
    """
    全体の処理を実行する関数
    """
    course = course_temp(abs_dx, abs_dy)
    if test_mode:
        print('course:', course)

    course = convert(course)
    if test_mode:
        print('course:', course)
    print(course)


if __name__ == '__main__':
    main()


"""
参考
    Pythonで文字列を置換（replace, translate, re.sub, re.subn）
    https://note.nkmk.me/python-str-replace-translate-re-sub/
"""

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

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

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

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

xmove, ymove = tx - sx, ty- sy
move = "U"*ymove + "R" * xmove + "D" * ymove + "L" * xmove
move += "L" + "U" * (ymove+1) + "R" * (xmove+1) + "DR" + "D" * (ymove+1) + "L" * (xmove+1) + "U"
print(move)

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

x =tx-sx
y =ty-sy

ans=""
ans+=x*"R"
ans+=y*"U"
ans+=x*"L"
ans+=y*"D"

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

print ans

Solution (Python):
sx, sy, tx, ty = map(int, input().split())
for i in range(tx - sx):
    print("R", end = "")

for i in range(ty - sy):
    print("U", end = "")

print("R", end = "")

for i in range(ty - sy + 1):
    print("D", end = "")

for i in range(tx - sx + 1):
    print("L", end = "")

print("UU", end = "")

for i in range(tx - sx - 1):
    print("R", end = "")

for i in range(ty - sy - 1):
    print("U", end = "")

print("RU", end = "")

for i in range(tx - sx + 1):
    print("L", end = "")

for i in range(ty - sy + 1):
    print("D", end = "")

print("R", end = "")
print()

Solution (Python):



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


path += ['R'] * dx
path += ['U'] * dy
path += ['L'] * dx
path += ['D'] * dy


path += ['D']
path += ['R'] * (dx + 1)
path += ['U'] * (dy + 1)
path += ['L', 'U']
path += ['L'] * (dx + 1)
path += ['D'] * (dy + 1)
path += ['R']

print(''.join(path))

Solution (Python):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


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

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


if __name__ == '__main__':
    main()

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

Solution (Python):
ai = lambda: list(map(int, input().split()))

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

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

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

Solution (Python):
a,b,c,d=map(int,input().split());l="URDL";e,f=d-b,c-a;print("".join([l[i]*e+l[i+1]*(f) for i in[0,2]]+[l[(j+3)%4]+l[j]*(e+1)+l[j+1]*(f+1)+l[(j+2)%4] for j in[0,2]]))

Solution (Python):
p=lambda x:print(x,end="");a,b,c,d=map(int,input().split());l="URDL";e,f=d-b,c-a;
for i in[0,2]:p(l[i]*e+l[i+1]*(f))
for i in[0,2]:p(l[(i+3)%4]+l[i]*(e+1)+l[i+1]*(f+1)+l[(i+2)%4])

Solution (Python):
p=lambda x:print(x,end="")
a,b,c,d=map(int,input().split())
l="URDL"
e,f=d-b,c-a
for i in[0,2]:p(l[i]*e+l[i+1]*(f))
for i in[0,2]:p(l[(i+3)%4]+l[i]*(e+1)+l[i+1]*(f+1)+l[(i+2)%4])

Solution (Python):
a=lambda x:print(x,end="")
sx,sy,tx,ty=map(int,input().split())
l=["U","R","D","L"]
for i in[0,2]:
 a(l[i]*(ty-sy))
 a(l[i+1]*(tx-sx))
for i in[0,2]:
 a(l[(i+3)%4])
 a(l[i]*(ty-sy+1))
 a(l[i+1]*(tx-sx+1))
 a(l[(i+2)%4])

Solution (Python):
sx,sy,tx,ty=map(int,input().split())
a=["U","R","D","L"]
for i in[0,2]:
 print(a[i]*(ty-sy),end="")
 print(a[i+1]*(tx-sx),end="")
for i in[0,2]:
 print(a[(i+3)%4],end="")
 print(a[i]*(ty-sy+1),end="")
 print(a[i+1]*(tx-sx+1),end="")
 print(a[(i+2)%4],end="")

Solution (Python):
il = lambda: list(map(int, input().split()))
ils = lambda n, s="int(input())": [eval(s) for _ in range(n)]

sx, sy, tx, ty = il()
a = ["U", "R", "D", "L"]
for i in [0, 2]:
    print(a[i] * (ty-sy), end="")
    print(a[i+1] * (tx-sx), end="")
for i in [0, 2]:
    print(a[(i+3)%4], end="")
    print(a[i] * (ty-sy+1), end="")
    print(a[i+1] * (tx-sx+1), end="")
    print(a[(i+2)%4], end="")

Solution (Python):
xy = list(map(int, input().split()))

x = xy[2]-xy[0]
y = xy[3]-xy[1]

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

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

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

Solution (Python):
sx,sy,tx,ty=map(int,input().split())
a=(tx-sx)*"R"+(ty-sy)*"U"
a=a+a.replace("R","L").replace("U","D")
b="D"+(tx-sx+1)*"R"+(ty-sy+1)*"U"+"L"
b=b+b.translate(str.maketrans({"D":"U","U":"D","R":"L","L":"R"}))
print(a+b)

Solution (Python):

from __future__ import unicode_literals
from __future__ import print_function
import sys

LEFT = "L"
RIGHT = "R"
UP = "U"
DOWN = "D"

def move(x,y):
    xs = RIGHT*x if x > 0 else LEFT*(-x)
    ys = UP*y if y > 0 else DOWN*(-y)
    return ys + xs

def main():
    sx, sy, tx, ty = map(int,sys.stdin.read().split())

    x = tx - sx
    y = ty - sy

    ans = ""
    ans += move(x,y)
    ans += move(-x,-y)
    ans += LEFT + move(x+1,y+1) + DOWN
    ans += RIGHT + move(-(x+1),-(y+1)) + UP

    sys.stdout.write(ans)

if __name__ == '__main__':
    main()

Solution (Python):

from __future__ import unicode_literals
from __future__ import print_function
import sys
import itertools

def move(x,y):
    xs = "R"*x if x > 0 else "L"*(-x)
    ys = "U"*y if y > 0 else "D"*(-y)
    return (xs, ys)

def main():
    sx, sy, tx, ty = map(int,sys.stdin.read().split())
    x = tx - sx
    y = ty - sy

    xs, ys = move(x,y)
    ans = ys + xs

    xs, ys = move(-x,-y)
    ans += ys + xs

    xs, ys = move(x+1,y+1)
    ans += "L" + ys + xs + "D" 

    xs, ys = move(-(x+1),-(y+1))
    ans += "R" + ys + xs + "U" 

    sys.stdout.write(ans)

if __name__ == '__main__':
    main()

Solution (Python):
sx,sy,tx,ty=map(int,input().split())
dx=tx-sx
dy=ty-sy
 
a="U"*dy+"R"*dx
b="D"*dy+"L"*dx
c="L"+"U"*(dy+1)+"R"*(dx+1)+"D"
d="R"+"D"*(dy+1)+"L"*(dx+1)+"U"
print(a+b+c+d)

Solution (Python):
sx,sy,tx,ty = map(int,input().split())
dx,dy = abs(sx-tx), abs(sy-ty)
fx,bx = 'RL' if sx < tx else 'LR'
fy,by = 'UD' if sy < ty else 'DU'
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)

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

dx = tx - sx
dy = ty - sy

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"
        
print(ans)

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

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

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

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

Solution (Python):
sx, sy, tx, ty=map(int,input().split())
ux=tx-sx
uy=ty-sy
S_ans=str('')
S_forw_x=str('')
S_forw_y=str('')
S_back_x=str('')
S_back_y=str('')
for i in range(ux):
    S_forw_x=S_forw_x+'R'
    S_back_x=S_back_x+'L'
for i in range(uy):
    S_forw_y=S_forw_y+'U'
    S_back_y=S_back_y+'D'
S_ans=S_forw_x+S_forw_y+S_back_x+S_back_y+'D'+S_forw_x+'RU'+S_forw_y+'LU'+S_back_x+'LD'+S_back_y+'R'
print(S_ans)

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

yu = "U" * (ty - sy)
xr = "R" * (tx - sx)
yd = "D" * (ty - sy)
xl = "L" * (tx - sx)

print(yu + xr + yd + xl + "L" + yu + "U" + xr + "R" + "D" + "R" + yd + "D" + xl + "L" + "U")

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

print("".join(map(str, rec)))

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

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

Solution (Python):
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) + 'D' +
      'R' + 'D' * (ty - sy + 1) + 'L' * (tx - sx + 1) + 'U'
     )

Solution (Python):
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) + 'D' +
      'R' + 'D' * (ty - sy + 1) + 'L' * (tx - sx + 1) + 'U'
     )

Solution (Python):

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

    x = tx -sx
    y = ty -sy

    ans = "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(ans)

if __name__ == "__main__":
        main()

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

r = 'U' * ty + 'R' * tx + 'D' * ty + 'L' * (tx+1) + \
    'U' * (ty+1) + 'R' * (tx+1) + 'DR' + 'D' * (ty+1) + 'L' * (tx+1) + 'U'
print(r)

Solution (Python):

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

    x = tx -sx
    y = ty -sy

    ans = "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(ans)

if __name__ == "__main__":
        main()

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

dx = abs(tx - sx)
dy = abs(ty - sy)

ans = ''

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

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

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)

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

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

x_diff = tx - sx
y_diff = ty - sy

S = []
for i in range(x_diff):
    S.append("R")
for i in range(y_diff):
    S.append("U")
for i in range(x_diff):
    S.append("L")
for i in range(y_diff):
    S.append("D")
S.append("L")
for i in range(y_diff + 1):
    S.append("U")
for i in range(x_diff + 1):
    S.append("R")
S.append("D")
S.append("R")
for i in range(y_diff + 1):
    S.append("D")
for i in range(x_diff + 1):
    S.append("L")
S.append("U")
print(''.join(S))

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

a="U"*dy+"R"*dx
b="D"*dy+"L"*dx
c="L"+"U"*(dy+1)+"R"*(dx+1)+"D"
d="R"+"D"*(dy+1)+"L"*(dx+1)+"U"
print(a+b+c+d)

Solution (Python):


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

    diff = [tx - sx, ty - sy]
    for i in range(diff[1]):
        print('U', end='')
    for i in range(diff[0]):
        print('R', end='')
    for i in range(diff[1]):
        print('D', end='')
    for i in range(diff[0]):
        print('L', end='')
    
    print('L', end='')

    for i in range(diff[1] + 1):
        print('U', end='')
    for i in range(diff[0] + 1):
        print('R', end='')
    
    print('D', end='')

    print('R', end='')

    for i in range(diff[1] + 1):
        print('D', end='')
    for i in range(diff[0] + 1):
        print('L', end='')

    print('U', end='')
    print('')

if __name__ == '__main__':
    main()

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

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

if __name__ == "__main__":
    main()

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

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

yoko = tx - sx
tate = ty - sy

ans1 = ""
ans2 = ""

ans2 += "LU"

for i in range(tate):
    ans1 += "U"
    ans2 += "U"
for i in range(yoko):
    ans1 += "R"
    ans2 += "R"

ans2 +="RDRD"

for i in range(tate):
    ans1 += "D"
    ans2 += "D"
for i in range(yoko):
    ans1 += "L"
    ans2 += "L"

ans2 += "LU"

print(ans1 + ans2)

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

    dy = ty-sy
    dx = tx-sx
    result = ''
    for i in range(dy):
        result += 'U'
    for i in range(dx):
        result += 'R'
    for i in range(dy):
        result += 'D'
    for i in range(dx):
        result += 'L'
    result += 'L'
    for i in range(dy+1):
        result += 'U'
    for i in range(dx+1):
        result += 'R'
    result += 'D'
    result += 'R'
    for i in range(dy+1):
        result += 'D'
    for i in range(dx+1):
        result += 'L'
    result += 'U'
    print result

main()

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

dx = tx - sx
dy = ty - sy

if dx > 0 and dy > 0:
    ptn = ['U', 'R', 'D', 'L', 0]
elif dx < 0 and dy > 0:
    ptn = ['U', 'L', 'D', 'R', 0]
elif dx > 0 and dy < 0:
    ptn = ['D', 'R', 'U', 'L', 0]
elif dx < 0 and dy < 0:
    ptn = ['D', 'L', 'U', 'R', 0]
elif dx == 0 and dy > 0:
    ptn = ['U', 'R', 'D', 'L', 1]
elif dx == 0 and dy < 0:
    ptn = ['D', 'R', 'U', 'L', 1]
elif dx > 0 and dy == 0:
    ptn = ['U', 'R', 'D', 'L', 2]
elif dx < 0 and dy == 0:
    ptn = ['D', 'R', 'U', 'L', 2]

ans = ''
if ptn[4] == 0:
    ans += ptn[0] * dy
    ans += ptn[1] * dx

    ans += ptn[2] * dy
    ans += ptn[3] * dx

    ans += ptn[3]
    ans += ptn[0] * (dy + 1)
    ans += ptn[1] * (dx + 1)
    ans += ptn[2]

    ans += ptn[1]
    ans += ptn[2] * (dy + 1)
    ans += ptn[3] * (dx + 1)
    ans += ptn[0]
elif ptn[4] == 1:
    ans += ptn[0] * dy

    ans += ptn[1]
    ans += ptn[2] * dy
    ans += ptn[3]

    ans += ptn[4]
    ans += ptn[0]
    ans += ptn[1]

    ans += ptn[0]
    ans += ptn[1] * 2
    ans += ptn[2] * (dy + 2)
    ans += ptn[3] * 2
    ans += ptn[0]
else:
    ans += ptn[1] * dx

    ans += ptn[0]
    ans += ptn[3] * dx
    ans += ptn[2]

    ans += ptn[2]
    ans += ptn[1] * dx
    ans += ptn[0]

    ans += ptn[1]
    ans += ptn[0] * 2
    ans += ptn[3] * (dy + 2)
    ans += ptn[2] * 2
    ans += ptn[1]
print(ans)

Solution (Python):

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

    x = tx - sx
    y = ty - sy

    ans = "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(ans)

if __name__ == "__main__":
        main()

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

x1 = tx - sx
y1 = ty - sy

l1 = ["U"] * y1 + ["R"] * x1 + ["D"] * y1 + ["L"] * x1
l2 = ["L"] * 1 + ["U"] * (y1 + 1) + ["R"] * (x1 + 1) + ["D"] * 1 + \
     ["R"] * 1 + ["D"] * (y1 + 1) + ["L"] * (x1 + 1) + ["U"] * 1

print("".join(l1 + l2))

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

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

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

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

def move(x, y):
    if x == 1:
        print('R', end='')
    elif x == -1:
        print('L', end='')
    elif y == 1:
        print('U', end='')
    elif y == -1:
        print('D', end='')
    else:
        print('Something wrong')


for i in range(tx):
    move(1, 0)      
for i in range(ty):
    move(0, 1)      
for i in range(tx):
    move(-1, 0)     
for i in range(ty):
    move(0, -1)     


move(-1, 0)
for i in range(ty + 1):
    move(0, 1)
for i in range(tx + 1):
    move(1, 0)
move(0, -1)
move(1, 0)
for i in range(ty + 1):
    move(0, -1)
for i in range(tx + 1):
    move(-1, 0)
move(0, 1)
print()

Solution (Python):
sx, sy, tx, ty = (int(x) for x in raw_input().split())
first = "R" * (tx-sx) + "U" * (ty - sy)
second = "L" * (tx-sx) + "D" * (ty - sy)
third = "D" + "R" * (tx-sx+1) + "U" * (ty-sy+1) + "L"
fourth = "U" + "L" * (tx-sx+1) + "D" * (ty-sy+1) + "R"
print first + second + third + fourth

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


S = [[sx, sy+1], [sx+1, sy], [sx, sy-1], [sx-1, sy]]
T = [[tx, ty+1], [tx+1, ty], [tx, ty-1], [tx-1, ty]]

diff_x = abs(sx - tx) 
diff_y = abs(sy - ty)

re = ''

re += 'U' * diff_y + 'R' * diff_x


re += 'D' * diff_y + 'L' * diff_x


re += 'L' + 'U' * (diff_y + 1) + 'R' * (diff_x + 1) + 'D'



re += 'R' + 'D' * (diff_y + 1) + 'L' * (diff_x + 1) + 'U'

print(re)

Solution (Python):

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

for i in range(ty - sy):
    print('U', end = "")

for i in range(tx - sx):
    print('R', end = "")

for i in range(ty - sy):
    print('D', end = "")

for i in range(tx - sx):
    print('L', end = "")

print('L', end = "")

for i in range(ty - sy + 1):
    print('U', end = "")

for i in range(tx - sx + 1):
    print('R', end = "")

print('D', end = "")

print('R', end = "")

for i in range(ty - sy + 1):
    print('D', end = "")

for i in range(tx - sx + 1):
    print('L', end = "")

print('U')

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

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

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

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

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

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

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

Solution (Python):

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)

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

Solution (Python):


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)

Solution (Python):


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)

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

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

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