#C3468. Robot Navigation

    ID: 46898 Type: Default 1000ms 256MiB

Robot Navigation

Robot Navigation

A robot is initially positioned at the origin \((0, 0)\) on a 2D plane. The robot receives a sequence of commands represented by a string. Each character in the string is one of the following commands:

  • 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)

Your task is to determine the final coordinates of the robot after executing the entire sequence of moves. For example, given the command string "UURDDL", the final position is \((0, 0)\).

inputFormat

Input is read from stdin and consists of a single line containing a string of characters representing the robot commands.

Example: UURDDL

outputFormat

The output should be printed to stdout as two integers separated by a single space, representing the final \(x\) and \(y\) coordinates of the robot.

Example: 0 0

## sample
UURDDL
0 0

</p>