A person wants to go from origin to a particular location, he can move in only 4 directions(i.e East, West, North, South) but his friend gave him a long route, help a person to find minimum Moves so that he can reach to the destination.
Note: You need to print the lexicographically sorted string. Assume the string will have only ‘E’ ‘N’ ‘S’ ‘W’ characters.
The first line of input contains an integer T denoting the number of test cases. The first line of each test case is S, S is the long route(string).
Print minimum Moves so that he can reach to the destination.
1 ≤ T ≤ 100
1 ≤ |length of S| ≤ 1000
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.