2021 Azerbaijan, Republic Informatics Olympiad, Semifinal, March 8
The drone is located on the XY coordinate plane and starts its movement from the point (0, 0), every second moving one unit along the X or Y axis. Along the coordinate axes, you can move in both directions. After executing the movement commands, the drone explodes at the end of the path. Determine the coordinates of the drone explosion.
Along the X axis, forward movement is indicated by “>”, and backward movement is indicated by “<”.
Along the Y axis, forward movement is indicated by “^”, and backward movement is indicated by “v”.
The first line contains one integer t (1 ≤ t ≤ 100) - the number of test cases.
Each of the following t lines contains a sequence of s (1 ≤ |s| ≤ 1000) characters indicating the movement of the drone. The |s| notation denotes the length of the string s.
For each test case, print on a separate line two integers - the coordinates X and Y of the drone explosion.
2 >>^ >>^^v<
2 1 1 1