Grid Walk
Starting at (0, 0), follow the moves U (y+1), D (y−1), L (x−1), R (x+1). Print the final coordinates.
Input: one line with the move string S.
Output: two integers: the final x and y.
Constraints:
- 1 ≤ |S| ≤ 105
Sample Tests
Input 1
URDL
Output 1
0 0
Input 2
UUU
Output 2
0 3
Discussion (opens after you solve — no spoilers before)
No comments yet.