#K83592. Final Robot Position
Final Robot Position
Final Robot Position
You are given a string that represents the movement sequence of a robot. The robot starts at the origin \( (0, 0) \). Each character in the string represents a move:
- U: Move up (increase \( y \) coordinate by 1)
- D: Move down (decrease \( y \) coordinate by 1)
- L: Move left (decrease \( x \) coordinate by 1)
- R: Move right (increase \( x \) coordinate by 1)
The final position \( (x, y) \) is determined by:
\( x = \text{count}(R) - \text{count}(L) \) and \( y = \text{count}(U) - \text{count}(D) \).
For example, if the input is "UUDDLRLR", the final position is \( (0, 0) \).
inputFormat
A single line containing a string representing the sequence of moves. Each character is one of 'U', 'D', 'L', or 'R'.
outputFormat
Output two integers separated by a space representing the final x and y coordinates of the robot.## sample
UUDDLRLR
0 0