#C14591. Robot Navigation on a 2D Grid
Robot Navigation on a 2D Grid
Robot Navigation on a 2D Grid
This problem simulates the movement of a robot on a 2D grid. The robot starts at the origin \((0, 0)\) and follows a sequence of movement commands. Each valid command will change the robot's coordinates: an "up" command increases the y-coordinate, "down" decreases the y-coordinate, "left" decreases the x-coordinate, and "right" increases the x-coordinate. Invalid commands are ignored.
Your task is to compute the final coordinates of the robot after processing all the movement commands.
inputFormat
The input is read from stdin. The first line contains a single integer \(n\), which is the number of movement commands. Each of the following \(n\) lines contains a single string representing a movement command. The valid commands are "up", "down", "left", and "right". Any other inputs should be ignored.
outputFormat
Output the final x and y coordinates, separated by a space, on a single line.
## sample0
0 0