#1274. USACO 2021 February Contest, Bronze —— Problem 3. Clockwise Fence

USACO 2021 February Contest, Bronze —— Problem 3. Clockwise Fence

说明

The fence surrounding Farmer John's largest pasture has fallen into disrepair, and he has finally decided to replace it with a new fence. Unfortunately, as Farmer John is laying out the new fence, a large bee ends up chasing him around the pasture, and as a result, the fence ends up following a rather irregular path. The fence can be described by a string of characters, each either "N" (north), "E" (east), "S" (south), or "W" (west). Each character describes a 1-meter run of the fence. For example, if the string is NESW, this means the fence starts by moving north for 1 meter, then east for 1 meter, then south for 1 meter, then west for 1 meter, returning to its starting point.
The fence ends at the position where it started, and this is the only point visited more than once by the path of the fence (and the starting point is only re-visited once, at the end). As a result, the fence does indeed enclose a single connected region of the grassy pasture, even though this region could have a rather strange shape.
Farmer John is curious if the path in which he laid the fence traveled clockwise (with the enclosed region on the right side of the fence as one walks along the path of the fence in the order specified by the string) or counter-clockwise (with the enclosed region on the left side of the fence).


围绕 Farmer John 最大的草地的栅栏已经损坏了,如今他终于决定要换一个新的栅栏。
不幸的是,当 Farmer John 在铺设新栅栏时,一只巨大的蜜蜂突然出现,在他的草地上追着他跑,导致最后栅栏被沿着一条相当不规则的路径铺设。栅栏可以用一个字符串表示,每个字符为 "N"(north,北)、"E"(east,东)、"S"(south,南)、"W"(west,西)之一。每个字符表示一米长的一段栅栏。举例来说,如果字符串为 NESW,这表示栅栏从起点开始向北延伸 1 米,然后向东延伸 1 米,然后向南延伸 1 米,然后向西延伸 1 米,回到栅栏的起点。
栅栏的结束位置与开始位置相同,而这是栅栏的路径上唯一会被到达多次的位置(从而起始位置是唯一会被再次到达的位置,在栅栏结束之时)。结果,栅栏确实围起了一个草地上连通的区域,尽管这个区域可能形状十分奇特。
Farmer John 想要知道他铺设栅栏的路径是顺时针(当按字符串表示的顺序沿着栅栏的路径行走时被围起的区域位于右侧)还是逆时针(被围起的区域位于左侧)。


输入格式

The first line of input contains an integer $N\ (1≤N≤20)$. 
Each of the next $N$ lines contains a string of length at least $4$ and at most $100$, describing a single fence path.
输入的第一行包含一个整数 $N\ (1≤N≤20)$。
以下 $N$ 行每行包含一个长度不小于 4 且不超过 100 的字符串,表示一个栅栏的路径。

输出格式

For each of the $N$ fence paths described in the input, output a line containing either "CW" (clockwise) or "CCW" (counterclockwise).
对 $N$ 条输入的栅栏路径的每一条,输出一行,为 "CW"(clockwise,顺时针)或 "CCW"(counterclockwise,逆时针)。

样例

2
NESW
WSSSEENWNEESSENNNNWWWS
CW
CCW

提示

USACO 2021 February Contest, Bronze