def solution(R, C, moves):
ur, uc = R, C
for m in moves:
if m == 'U':
ur += 1
if m == 'D':
ur -= 1
if m == 'R':
uc += 1
if m == 'L':
uc -= 1
if ur < 1 or ur > 100 or uc < 1 or uc > 100:
ur, uc = R, C
return ur + uc
R = 2
C = 2
moves = ['U','R','R','D']
ret = solution(R, C, moves)
print("solution 함수의 반환 값은", ret, "입니다.")
To embed this project on your website, copy the following code and paste it into your website's HTML: