#K62127. Final Coordinates After Moves

    ID: 31463 Type: Default 1000ms 256MiB

Final Coordinates After Moves

Final Coordinates After Moves

You are given a starting point with coordinates \( (X, Y) \) and a string \( S \) that represents a series of moves. Each character in \( S \) can be one of the following: U (up), D (down), L (left), or R (right). Each move updates the coordinates as follows:

  • U: Increase \( Y \) by 1
  • D: Decrease \( Y \) by 1
  • L: Decrease \( X \) by 1
  • R: Increase \( X \) by 1

Your task is to compute the final coordinates after performing all the moves in \( S \). The input will be read from standard input and the result should be printed to standard output.

inputFormat

The input consists of two lines:

  1. The first line contains a non-empty string S representing the moves. Each character in S is either U, D, L, or R.
  2. The second line contains two space-separated integers: X and Y, representing the initial coordinates.

outputFormat

Output a single line containing two space-separated integers: the final \( X \) and \( Y \) coordinates after all moves are applied.

## sample
UUDDLRLR
0 0
0 0