#C2962. Robot Final Position
Robot Final Position
Robot Final Position
Problem Statement:
A robot starts at the origin \( (0, 0) \) in a 2D plane. It receives a string of instructions, where each character is one of \( N \), \( S \), \( E \), or \( W \). The instructions cause the robot to move one unit in the corresponding direction:
- \( N \): Move north (increase \( y \) by 1).
- \( S \): Move south (decrease \( y \) by 1).
- \( E \): Move east (increase \( x \) by 1).
- \( W \): Move west (decrease \( x \) by 1).
After executing all instructions, compute the final position of the robot.
inputFormat
The input is read from stdin and is formatted as follows:
- The first line contains an integer \( T \) (\( T \geq 1 \)) representing the number of test cases.
- Each of the following \( T \) lines contains a string made up of the characters \( N \), \( S \), \( E \), and \( W \), which represent the robot's movement instructions.
outputFormat
For each test case, output a single line to stdout containing two space-separated integers \( x \) and \( y \), which represent the final coordinates of the robot after processing the given instructions.
## sample1
NESW
0 0
</p>