407918: GYM102942 A Directional Move
Description
There is a binary string consisting of characters '0' and '1'. Initially, Bob is facing East when he starts reading the binary string. When he sees a '0', he turns $$$90^\circ$$$ to his right. When he sees a '1', he turns $$$90^\circ$$$ to his left.
The four directions are as follows: East is denoted by 'E', West by 'W', North by 'N', and South by 'S'.
![](https://espresso.codeforces.com/e4cde8b09992a3f083574b36d2577ceeaa5f2db0.png)
After reading the entire string, which direction will Bob face?
InputThe first line contains an integer $$$t$$$ $$$(1 \leq t \leq 10^{2})$$$ $$$-$$$ the number of test cases in the input.
Then $$$t$$$ test cases follow.
The first line of the test case contains one integer $$$n$$$ $$$( 1 \leq n \leq 10^{5} )$$$.
The second line of the test case contains a string $$$s$$$ of $$$n$$$ characters, consisting only '0' and '1'.
It is guaranteed that the sum of the values of $$$n$$$ for all test cases in the input does not exceed $$$2\cdot10^{5}$$$.
OutputFor each test case, Print a single character — the direction Bob is facing after reading the string.
ExampleInput3 4 1010 5 00000 3 111Output
E S SNote
In the first test, for the first two moves, Bob turns $$$90^{\circ}$$$ left and then turns $$$90^{\circ}$$$ right. So, he is back to his initial orientation. Again he repeats the same for the other two moves. So his final direction is East.
In the second test, After $$$4$$$ moves Bob is back to his initial orientation, and after the next $$$90^{\circ}$$$ right move, he will be facing South.