#K57477. Robot Final Position
Robot Final Position
Robot Final Position
You are given a string representing the moves of a robot. The robot starts at the origin point \((0,0)\) on a 2D plane. Each character in the string is one of the following:
- U: Move up by 1 unit (\(y = y+1\)).
- D: Move down by 1 unit (\(y = y-1\)).
- L: Move left by 1 unit (\(x = x-1\)).
- R: Move right by 1 unit (\(x = x+1\)).
Your task is to compute and output the final coordinates \((x, y)\) of the robot after processing the entire string of moves.
Note: The final result must be printed to the standard output with the x-coordinate and y-coordinate separated by a space.
inputFormat
The input consists of a single line containing a non-empty string composed of characters 'U', 'D', 'L', and 'R' without spaces.
outputFormat
Output the final x and y coordinates separated by a single space.
## sampleUDLR
0 0