Hello Chefs,
Will you please help me in finding error in following code, every time it is giving WA for the hidden TCs!!
Problem link : ZUBREACH Problem - CodeChef
Submissions link : CodeChef: Practical coding for everyone
for t in range(1,int(input())+1):
m,n = map(int,input().split())
rx,ry = map(int,input().split())
n = int(input())
x,y,l = 0,0,input()
for i in l:
if i=='L':
x -= 1
elif i=='R':
x += 1
elif i=='U':
y += 1
else:
y -= 1
if x==rx and y==ry:
dir = 'REACHED'
elif x<0 or x>m or y<0 or y>n:
dir = 'DANGER'
else:
dir = 'SOMEWHERE'
print('Case {}: {}'.format(t,dir))