#K4641. RoboCleaner Final Position

    ID: 27970 Type: Default 1000ms 256MiB

RoboCleaner Final Position

RoboCleaner Final Position

RoboCleaner navigates a two-dimensional grid by following a set of movement commands. Initially, it is positioned at the origin \( (0, 0) \). Each command in the input string represents a direction: 'U' for up, 'D' for down, 'L' for left, and 'R' for right.

After processing all the commands, the final position \( (x, y) \) can be computed as follows:

  • \( x = \) (number of 'R' commands) \( - \) (number of 'L' commands)
  • \( y = \) (number of 'U' commands) \( - \) (number of 'D' commands)

Your task is to print the final coordinates as two space-separated integers.

inputFormat

A single line of text containing only the characters 'U', 'D', 'L', and 'R'. The string may be empty.

outputFormat

Two space-separated integers representing the final x and y coordinates after executing all commands.## sample

UUDDLRLR
0 0