#C4390. Robot Final Coordinates
Robot Final Coordinates
Robot Final Coordinates
Given a sequence of moves for a robot on a two-dimensional plane, determine its final coordinates. The robot starts at the origin (0,0) and follows the moves one by one. Each move is represented by a character: 'U' for up, 'D' for down, 'L' for left, and 'R' for right.
You can calculate the final coordinates using the formulas below:
$$ x = \text{number of R moves} - \text{number of L moves} $$
$$ y = \text{number of U moves} - \text{number of D moves} $$
Implement a program that reads the number of moves and the moves themselves from standard input, and outputs the final x and y coordinates to standard output.
inputFormat
The first line contains an integer N representing the number of moves.
The second line contains N space-separated characters, each of which is one of 'U', 'D', 'L', or 'R'.
outputFormat
Output the final coordinates of the robot as two integers x and y separated by a space.
## sample4
U D L R
0 0