2D Game

1. Player actions

Our player will be moving in a 2D grid using a keyboard. Pressing any of the arrow keys will move the player one cell in the corresponding direction. The player starts at the cell (1,1) and can move in four directions: up, down, left, and right.

You are given a sequence of player actions (your input is available in the inputs pane on the right). The sequence consists of action types along with the number of times they are performed. For example, "R3" means the player moved right 3 times. Each move takes 1 time unit.

The possible action types are: L (left), R (right), U (up), D (down), and S (sleep). Sleep means that the player stays in the same cell for the given time.

Following the player's moves, what will be the coordinates of the player after the sequence is completed?

Example:

For the sequence U2 S4 L3 U2 R10:
  • Start at (1,1)
  • U2: Move 2 cells up, arriving at (1,3)
  • S4: Sleep for 4 time units (no movement)
  • L3: Move 3 cells to the left, arriving at (-2,3)
  • U2: Move 2 cells up, arriving at (-2,5)
  • R10: Move 10 cells to the right, arriving at (8,5)
the final coordinates are 8,5

What are the final coordinates of the player after the given sequence of moves? Submit the coordinates as two integers separated by a comma, with no spaces.