eolymp
bolt
Try our new interface for solving problems

Dron

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”.

Input

The first line contains one integer t (1t100) - 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.

Output

For each test case, print on a separate line two integers - the coordinates X and Y of the drone explosion.

Time limit 1 second
Memory limit 256 MiB
Input example #1
2
>>^
>>^^v<
Output example #1
2 1
1 1
Author Rashad Mammadov
Source 2021 Azerbaijan, Republic Informatics Olympiad, Semifinal, March 8