#K82297. Robot Final Position
Robot Final Position
Robot Final Position
You are given a string of commands, each character being one of 'U', 'D', 'L', or 'R'. The robot starts at the origin point \((0, 0)\) on a 2D plane. The commands have the following effects:
- U: Moves the robot up (i.e., increases the \(y\)-coordinate by 1).
- D: Moves the robot down (i.e., decreases the \(y\)-coordinate by 1).
- L: Moves the robot left (i.e., decreases the \(x\)-coordinate by 1).
- R: Moves the robot right (i.e., increases the \(x\)-coordinate by 1).
Your task is to compute the final coordinates \((x, y)\) of the robot after it processes all the commands.
Example:
Input: UURRDDLL Output: 0 0
inputFormat
The input is provided via standard input (stdin) and consists of a single line containing a non-empty string. This string represents the sequence of commands.
outputFormat
The output should be written to standard output (stdout) and must contain two integers separated by a space representing the final \(x\) and \(y\) coordinates of the robot.
## sampleUURRDDLL
0 0