#C1681. Final Position of a Robot

    ID: 44913 Type: Default 1000ms 256MiB

Final Position of a Robot

Final Position of a Robot

You are given a string movements consisting only of the characters U, D, L, and R. These characters represent moves of a robot starting at the origin \((0,0)\) on a Cartesian plane. The moves have the following effects:

  • U: Move up by 1 unit (i.e. increase y-coordinate by 1).
  • D: Move down by 1 unit (i.e. decrease y-coordinate by 1).
  • L: Move left by 1 unit (i.e. decrease x-coordinate by 1).
  • R: Move right by 1 unit (i.e. increase x-coordinate by 1).

Your task is to compute and output the final position \((x, y)\) of the robot after processing all moves.

Note: The formula to compute the final coordinates is given by:

\[ x = \text{number of R moves} - \text{number of L moves}\\ y = \text{number of U moves} - \text{number of D moves} \]

inputFormat

The input consists of a single line containing a string movements, which represents the sequence of moves. The string will only contain the characters U, D, L, and R.

outputFormat

Output two integers separated by a space: the final x-coordinate and y-coordinate of the robot after performing all the moves.

## sample
UU
0 2