Problem:
 Score : 200 points    Problem Statement Snuke lives on an infinite two-dimensional plane. He is going on an N -day trip.
At the beginning of Day 1 , he is at home. His plan is described in a string S of length N .
On Day i(1 ≦ i ≦ N) , he will travel a positive distance in the following direction:   North if the i -th letter of S is N  West if the i -th letter of S is W  South if the i -th letter of S is S  East if the i -th letter of S is E   He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N .      Constraints  1 ≦ | S | ≦ 1000  S consists of the letters N , W , S , E .         Input The input is given from Standard Input in the following format:  S       Output Print Yes if it is possible to set each day's travel distance so that he will be back at home at the end of Day N . Otherwise, print No .        Sample Input 1 SENW      Sample Output 1 Yes  If Snuke travels a distance of 1 on each day, he will be back at home at the end of day 4 .       Sample Input 2 NSNNSNSN      Sample Output 2 Yes       Sample Input 3 NNEW      Sample Output 3 No       Sample Input 4 W      Sample Output 4 No

Solution (Python):
S = input()
ans_NS = 0
ans_EW = 0

if S.count('S') >= 1:
    ans_NS += 1
if S.count('N') >= 1:
    ans_NS += 1
if S.count('E') >= 1:
    ans_EW += 1
if S.count('W') >= 1:
    ans_EW += 1

if ans_EW != 1:
    if ans_NS != 1:
        print('Yes')
        exit()

print('No')

Solution (Python):



s = set(input())
if (('N' in s and 'S' in s) or not('N' in s) and not('S' in s)) and (('E' in s and 'W' in s) or not('E' in s) and not('W' in s)):
    print ('Yes')
else:
    print ('No')

Solution (Python):
def NS(S):
  return ("N" in S) ^ ("S" in S)

def EW(S):
  return ("E" in S) ^ ("W" in S)



S = input()
if not(NS(S)) and not(EW(S)):
  print("Yes")
else:
  print("No")

Solution (Python):
s=input()
if s.count("N")>0 and s.count("S")==0:
    print("No")
elif s.count("W")>0 and s.count("E")==0:
    print("No")
elif s.count("N")==0 and s.count("S")>0:
    print("No")
elif s.count("W")==0 and s.count("E")>0:
    print("No")
else:print("Yes")

Solution (Python):
S = input()
dict = {
    "N": False,
    "E": False,
    "W": False,
    "S": False
}
for s in S:
    dict[s] = True

if dict["N"] != dict["S"] or dict["E"] != dict["W"]:
    print("No")
else:
    print("Yes")

Solution (Python):
S = input()
S = list(S)
flag = True
if ('N' in S and 'S' not in S):
    flag = False;
if ('S' in S and 'N' not in S):
    flag = False
if ('E' in S and 'W' not in S):
    flag = False
if ('W' in S and 'E' not in S):
    flag = False
if flag:
    print('Yes')
else:
    print('No')

Solution (Python):

s = input()

dicti = {'N':0, 'S':0, 'W':0, 'E':0}
for letter in s:
    dicti[letter] += 1
if dicti['N'] > 0 and dicti['S'] > 0:
    if dicti['W'] > 0 and dicti['E'] > 0:
        print('Yes')
    elif dicti['W'] == 0 and dicti['E'] == 0:
        print('Yes')
    else:
        print('No')
elif dicti['W'] > 0 and dicti['E'] > 0:
    if dicti['N'] > 0 and dicti['S'] > 0:
        print('Yes')
    elif dicti['N'] == 0 and dicti['S'] == 0:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Solution (Python):
s=input()
if "N" in s and "S" in s and "E" in s and "W" in s:
    print("Yes")
elif "N" in s and "S" in s and "E" not in s and "W" not in s:
    print("Yes")
elif "N" not in s and "S" not in s and "E" in s and "W" in s:
    print("Yes")
else:
    print("No")

Solution (Python):
s=input()
ans=[0,0]
n=0
S=0
w=0
e=0
for i in range(len(s)):
    if s[i]=="N":
        n=1
    elif s[i]=="S":
        S=1
    elif s[i]=="W":
        w=1
    elif s[i]=="E":
        e=1
print("Yes" if n*S==1 and (w+e==2 or w+e==0) or w*e==1 and (n+S==2 or n+S==0) else "No")

Solution (Python):
S=input()
if (S.count('N')>0) == (S.count('S')>0) and (S.count('W')>0) == (S.count('E')>0):
    print('Yes')
else:
    print('No')

Solution (Python):
s=input()
x='Yes'
if 'N' in s:
  if 'S' not in s:
    x='No'
else:
  if 'S' in s:
    x='No'
if 'E' in s:
  if 'W' not in s:
    x='No'
else:
  if 'W' in s:
    x='No'
print(x)

Solution (Python):
s = input()
f1 = ('N' in s and 'S' in s) or ('N' not in s and 'S' not in s)
f2 = ('W' in s and 'E' in s) or ('W' not in s and 'E' not in s)
f3 = f1 and f2
if f3:
    print("Yes")
else:
    print("No")

Solution (Python):
S = set(input())

if len(S) == 4:
    print('Yes')
elif len(S) == 3 or len(S) == 1:
    print('No')
else:  
    if S == {'N', 'S'} or S == {'E', 'W'}:
        print('Yes')
    else:
        print('No')

Solution (Python):

import sys
def input(): return sys.stdin.readline().rstrip()
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, ceil, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
import heapq
INF = float("inf")
sys.setrecursionlimit(10**7)

dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
def inside(y: int, x: int, H: int, W: int) -> bool: return 0 <= y < H and 0 <= x < W
def mi(): return map(int, input().split())
def ii(): return int(input())


S = input()

setS = set(S)

check1 = {'E', 'W'}
check2 = {'S', 'N'}

ansflag1 = True
ansflag2 = True
for eachd in setS:
  if len(check1):
    if eachd in check1:
      ansflag1 = not ansflag1
      check1.remove(eachd)
  if len(check2):
    if eachd in check2:
      ansflag2 = not ansflag2
      check2.remove(eachd)

if ansflag1 and ansflag2: print('Yes')
else: print('No')

Solution (Python):
import sys
input = sys.stdin.readline

s = input()
cnt = 0
if 'N' in s and 'S' in s:
    cnt += 1
elif 'N' not in s and 'S' not in s:
    cnt += 1
if 'W' in s and 'E' in s:
    cnt += 1
elif 'W' not in s and 'E' not in s:
    cnt += 1
if cnt == 2:
    ans = 'Yes'
else:
    ans = 'No'
print(ans)

Solution (Python):
from collections import Counter


s = list(input())
s_cnt = Counter(s)
s_cnt_keys = list(s_cnt.keys())
if len(s_cnt.keys()) == 4:
    print('Yes')
    exit()
elif len(s_cnt.keys()) == 2:
    if s_cnt_keys[0] == 'S' and s_cnt_keys[1] == 'N':
        print('Yes')
        exit()
    elif s_cnt_keys[0] == 'N' and s_cnt_keys[1] == 'S':
        print('Yes')
        exit()
    elif s_cnt_keys[0] == 'E' and s_cnt_keys[1] == 'W':
        print('Yes')
        exit()
    elif s_cnt_keys[0] == 'W' and s_cnt_keys[1] == 'E':
        print('Yes')
        exit()
print('No')

Solution (Python):
s = input()
N = s.count('N')
S = s.count('S')
W = s.count('W')
E = s.count('E')
if N==0 and S:
    print('No')
elif S==0 and N:
    print('No')
elif E==0 and W:
    print('No')
elif W==0 and E:
    print('No')
else:
    print('Yes')

Solution (Python):
s = input().rstrip()

N = s.count('N')
W = s.count('W')
S = s.count('S')
E = s.count('E')

if (N > 0 and S == 0) or (N == 0 and S > 0):
    print('No')
    exit()
if (W > 0 and  E== 0) or (W == 0 and E > 0):
    print('No')
    exit()
print('Yes')

Solution (Python):
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))
class UnionFind():

    def __init__(self, n):
        self.n = n
        self.node = [i for i in range(n)]
        self.size = [1 for _ in range(n)]

    def same(self, x, y):
        return bool(self.root(x) == self.root(y))

    def root(self, x):
        if self.node[x] == x:
            return x
        else:
            self.node[x] = self.root(self.node[x])
            return self.node[x]

    def unite(self, x, y):
        x, y = self.root(x), self.root(y)
        if x == y:
            return  
        if self.size[x] < self.size[y]:
            x, y = y, x
        self.node[y] = x
        self.size[x] += self.size[y]

    def return_size(self, x):
        return self.size[self.root(x)]


s = IS()
if s.count('N') > 0 and s.count('S') == 0 or \
        s.count('N') == 0 and s.count('S') > 0 or \
        s.count('E') > 0 and s.count('W') == 0 or \
        s.count('E') == 0 and s.count('W') > 0:
    print('No')
else:
    print('Yes')

Solution (Python):
s = input()
flag = True
if "N" in s:
    if "S" not in s:
        flag = False
if "S" in s:
    if "N" not in s:
        flag = False
if "E" in s:
    if "W" not in s:
        flag = False
if "W" in s:
    if "E" not in s:
        flag = False
if flag:
    print("Yes")
else:
    print("No")

Solution (Python):
s=list(input())
w=['N','W','S','E']
q=[]
for i in range(4):
    if s.count(w[i])>0:
        q.append(1)
    else:
        q.append(0)
if q[0]==q[2] and q[1]==q[3]:
    print('Yes')
else:
    print('No')

Solution (Python):
from fractions import gcd
import math
def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft



def main():
    s = input()
    if ('N' in s) ^ ('S' in s):
        print('No')
        return
    if ('E' in s) ^ ('W' in s):
        print('No')
        return
    print('Yes')

main()

Solution (Python):
S = input()

direct = 'NWSE'
cnt = {}
ans = "Yes"

for ch in direct:
    cnt[ch] = S.count(ch)

if cnt['N'] == 0 and cnt['S'] != 0:
    ans = "No"
elif cnt['N'] != 0 and cnt['S'] == 0:
    ans = 'No'
elif cnt['E'] != 0 and cnt['W'] == 0:
    ans = 'No'
elif cnt['E'] == 0 and cnt['W'] != 0:
    ans = 'No'

print(ans)

Solution (Python):
import sys
S = set(input())
ls = ['N','W','S','E']
if ls[0] in S and not ls[2] in S:
    print('No')
    sys.exit()
if ls[1] in S and not ls[3] in S:
    print('No')
    sys.exit()
if ls[2] in S and not ls[0] in S:
    print('No')
    sys.exit()
if ls[3] in S and not ls[1] in S:
    print('No')
    sys.exit()
print('Yes')

Solution (Python):
s = set(input())
print("Yes" if ("N" in s)==("S" in s) and ("E" in s)==("W" in s) else "No")

Solution (Python):
s = set(input())
if s == set(["N","S"]) or s == set(["W","E"]) or  s == set(["W","E","N","S"]):
  print("Yes")
else:
  print("No")

Solution (Python):
S = input()
if (S.count('N') > 0 and S.count('S') == 0) or (S.count('S') > 0 and S.count('N') == 0):
    print('No')
elif (S.count('E') > 0 and S.count('W') == 0) or (S.count('W') > 0 and S.count('E') == 0):
    print('No')
else:
    print('Yes')

Solution (Python):
S = input()

if 'N' in S:
    if 'S' not in S:
        print('No')
        exit()

if 'S' in S:
    if 'N' not in S:
        print('No')
        exit()

if 'W' in S:
    if 'E' not in S:
        print('No')
        exit()

if 'E' in S:
    if 'W' not in S:
        print('No')
        exit()

print('Yes')

Solution (Python):
s = input()
N = "N" in s
W = "W" in s
S = "S" in s
E = "E" in s
if N ^ S or W ^ E:
    print("No")
else:
    print("Yes")

Solution (Python):
Plan=input()
N,W,S,E=Plan.count("N"),Plan.count("W"),Plan.count("S"),Plan.count("E")
if (N==0 and S>=1) or (N>=1 and S==0) or (W==0 and E>=1) or (W>=1 and E==0):
    print("No")
else:
    print("Yes")

Solution (Python):
S = input()
if "N" in S:
    if "S" not in S:
        print("No")
        exit()
elif "S" in S:
    if "N" not in S:
        print("No")
        exit()

if "W" in S:
    if "E" not in S:
        print("No")
        exit()
elif "E" in S:
    if "W" not in S:
        print("No")
        exit()
print("Yes")

Solution (Python):
se = set(input())
print('Yes' if se == set('WE') or se == set('NS') or se == set('WENS') else 'No')

Solution (Python):
s = list(input())
n = [None]*2
if "S" in s and "N" in s:
  n[0] = 1
elif "S" in s and "N" not in s:
  n[0] = 0
elif "S" not in s and "N" in s:
  n[0] = 0
if "W" in s and "E" in s:
  n[1] = 1
elif "W" in s and "E" not in s:
  n[1] = 0
elif "W" not in s and "E" in s:
  n[1] = 0
if n.count(1)==2:
  print("Yes")
elif 0 in n:
  print("No")
elif None in n and n.count(1) == 1:
  print("Yes")

Solution (Python):
S=input()
print("NYoe s"[
    (("N" in S) == ("S" in S))and(("E" in S) == ("W" in S))
    ::2])

Solution (Python):
a = input()
n,f = 0,1
if 'N' in a:
    if 'S' in a:
        n = 1
    else:
        f = 0
if 'W' in a:
    if 'E' in a:
        n = 1
    else:
        f = 0
if 'S' in a:
    if 'N' in a:
        n = 1
    else:
        f = 0
if 'E' in a:
    if 'W' in a:
        n = 1
    else:
        f = 0
if (n*f) == 1:
    print('Yes')
else:
    print('No')

Solution (Python):
s=list(input())
l=[0]*4
if "N" in s:
    l[0]=1
if "S" in s:
    l[1]=-1
if "E" in s:
    l[2]=2
if "W" in s:
    l[3]=-2
if sum(l)==0:
    print("Yes")
else:
    print("No")

Solution (Python):
letterlist = ['N', 'E', 'S', 'W']
S = input()
news = [False, False, False, False]
for i in range(0, len(S)):
	for j in range(0, 4):
		if S[i] == letterlist[j]: news[j] = True
if (news[0]^news[2]) or (news[1]^news[3]): print('No')
else: print('Yes')

Solution (Python):
s=input()
f=True
if 'W' in s and not 'E' in s:f=False
if 'E' in s and not 'W' in s:f=False
if 'N' in s and not 'S' in s:f=False
if 'S' in s and not 'N' in s:f=False

print(["No","Yes"][f])

Solution (Python):
S = input()

d_set = set()
for s in S:
    d_set.add(s)

if ("N" in d_set and "S" not in d_set) or  ("S" in d_set and "N" not in d_set) or  ("E" in d_set and "W" not in d_set) or ("W" in d_set and "E" not in d_set):
    print("No")
else:
    print("Yes")

Solution (Python):
s = input()
if (s.count("N")>0 and s.count("S")==0)\
    or (s.count("S")>0 and s.count("N")==0)\
    or (s.count("W")>0 and s.count("E")==0)\
    or (s.count("E")>0 and s.count("W")==0):
    print("No")
else:
    print("Yes")

Solution (Python):
s = list(input())
N = 0
W = 0
S = 0
E = 0
for i in s:
  if i == 'N':
    N = 1
  if i == 'W':
    W = 1
  if i == 'S':
    S = 1
  if i == 'E':
    E = 1
if ((N == 0 and S == 0) or (N == 1 and S == 1)) and ((W == 0 and E == 0) or (W == 1 and E == 1)):
  print('Yes')
else:
  print('No')

Solution (Python):
from sys import stdin
S = set(list(stdin.readline().rstrip()))
if len(S) % 2 != 0: 
    print("No")
elif S == {"N","S"} or S == {"W","E"}:
    print("Yes")
elif len(S) == 4:
    print("Yes")
else:
    print("No")

Solution (Python):
def main():
    S = input()
    move = {
        "E": False,
        "W": False,
        "N": False,
        "S": False
    }
    for c in S:
        move[c] = True
    if move["E"] == move["W"] and move["N"] == move["S"]:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

Solution (Python):
s = input()

if 'E' in s and 'W' in s:
    if 'N' in s and 'S' in s:
        print('Yes')
    elif 'N' in s or 'S' in s:
        print('No')
    else:
        print('Yes')
elif 'E' in s or 'W' in s:
    print('No')
else:
    if 'N' in s and 'S' in s:
        print('Yes')
    elif 'N' in s or 'S' in s:
        print('No')
    else:
        print('Yes')

Solution (Python):
a = str(input())
n = 0
w = 0
e = 0
s = 0
for i in a:
    if i == "N":
        n += 1
    elif i == "W":
        w += 1
    elif i == "E":
        e += 1
    elif i == "S":
        s += 1
ans = True
if (n == 0 and s != 0) or (n != 0 and s == 0):
    ans = False
if (e == 0 and w != 0) or (e != 0 and w == 0):
    ans = False
if ans == True:
    print("Yes")
else:
    print("No")

Solution (Python):
path = list(input())
if ('N' in path) is True:
    north = 1
else:
    north = 0
if ('S' in path) is True:
    south = -1
else:
    south = 0
if ('E' in path) is True:
    east = 1
else:
    east = 0
if ('W' in path) is True:
    west = -1
else:
    west = 0
if ((north + south) == 0) and ((east + west) == 0):
    print("Yes")
else:
    print("No")

Solution (Python):
S = set(input())
if len(S) == 4:
	print("Yes")
elif len(S) == 2 and "N" in S and "S" in S:
	print("Yes")
elif len(S) == 2 and "W" in S and "E" in S:
	print("Yes")
else:
	print("No")

Solution (Python):
s=input();f=lambda c:c in s;print(['Yes','No'][f('N')^f('S') or f('E')^f('W')])

Solution (Python):
s=input()
a =["N","S","W","E"]
flag1=0
flag2=0
if a[0] in s and a[1] in s:
  flag1=1
if a[0] not in s and a[1] not in s:
  flag1=1
if a[2] in s and a[3] in s:
  flag2=1
if a[2] not in s and a[3] not in s:
  flag2=1
if flag1+flag2==2:
  print("Yes")
else:
  print("No")

Solution (Python):

"""
A - Wanna go back home
https://atcoder.jp/contests/agc003/tasks/agc003_a

"""
import sys


def solve(S):
    if ('N' in S and 'S' not in S) or ('S' in S and 'N' not in S):
        return 'No'
    if ('E' in S and 'W' not in S) or ('W' in S and 'E' not in S):
        return 'No'
    return 'Yes'


def main(args):
    S = input()
    ans = solve(S)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Solution (Python):
s=input()
f=0
if "S" in s and "N" in s:pass
elif "S" in s or "N" in s:f=1
if "W" in s and "E" in s:pass
elif "W" in s or "E" in s:f=1
print("YNeos"[f::2])

Solution (Python):
S = input()
x = not (('S' in S)^('N' in S))
y = not (('E' in S)^('W' in S))
if(x and y):
    print('Yes')
else:
    print('No')

Solution (Python):
S = input()
n = S.count("N")
s = S.count("S")
w = S.count("W")
e = S.count("E")
ans = "Yes"
if n * s ==0:
    if n != 0 or s != 0:
        ans = "No"

if w * e ==0:
    if w != 0 or e != 0:
        ans = "No"

print(ans)

Solution (Python):
s=set(input())
ans='No'
if s in (set('SN'), set('EW'), set('NEWS')):
  ans='Yes'
print(ans)

Solution (Python):
seq=input()
N=seq.count("N")
S=seq.count("S")
E=seq.count("E")
W=seq.count("W")

if (N>0 and S==0) or (N==0 and S>0) or (E>0 and W==0) or (E==0 and W>0):
    print("No")
else:
    print("Yes")

Solution (Python):
s = input()
from collections import defaultdict
d = defaultdict(bool)
def inv(c):
    dic = {"W":"E", "E":"W", "S":"N", "N":"S"}
    return dic[c]
for c in s:
    d[c] = True
def sol():
    for c in "NSWE":
        if d[c] == True and d[inv(c)] == False:
            return False
    return True
print("YNeos"[not sol()::2])

Solution (Python):
S = input()

lm = {"N":0, "W":0, "S":0, "E":0}
for s in S:
	lm[s] += 1

n, w, s, e = lm["N"], lm["W"], lm["S"], lm["E"]

print(["Yes", "No"][not((n == s == 0 or (0 < n and 0 < s)) and (w == e == 0 or (0 < w and 0 < e)))])

Solution (Python):
c = list(input())
print(['Yes','No'][('N' in c)^('S' in c)or('E' in c)^('W' in c)])

Solution (Python):
S = input()
if "N" in S and "S" not in S:
    print("No")
elif "W" in S and "E" not in S:
    print("No")
elif "E" in S and "W" not in S:
    print("No")
elif "S" in S and "N" not in S:
    print("No")
else:
    print("Yes")

Solution (Python):
S = input()

if any(set(S) == s for s in map(set, ["NS", "EW", "NSEW"])):
    print("Yes")
else:
    print("No")

Solution (Python):
s = input()
s_num = s.count("S")
e_num = s.count("E")
n_num = s.count("N")
w_num = s.count("W")
c = 0
if ((s_num > 0) & (n_num > 0)) | (s_num + n_num == 0):
    c += 1
if ((e_num > 0) & (w_num > 0)) | (e_num + w_num == 0):
    c += 1
if c == 2:
    ans = "Yes"
else:
    ans = "No"
print(ans)

Solution (Python):
S=set(input())
s=len(S)
if s==4:
  print("Yes")
elif s==2:
  if S=={'E', 'W'} or S=={'N', 'S'}:
    print("Yes")
  else:
    print("No")
else:
  print("No")

Solution (Python):
S = input()
n = S.count('N')
w = S.count('W')
s = S.count('S')
e = S.count('E')

ans = 'Yes'
if n > 0 and s == 0 or n == 0 and s > 0:
    ans = 'No'
if w > 0 and e == 0 or w == 0 and e > 0:
    ans = 'No'

print(ans)

Solution (Python):
from itertools import accumulate
import math
from collections import deque
from collections import defaultdict
from itertools import permutations
import heapq
import bisect
from collections import Counter
from itertools import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = 10**10
from functools import reduce

s = input()
c = Counter(s)
if ((c["S"] == c["N"] == 0) or (c["S"]*c["N"] > 0)) and ((c["E"] == c["W"] == 0) or (c["E"]*c["W"] > 0)):
    print("Yes")
else:
    print("No")

Solution (Python):
s=''.join(sorted(set(input())))
print(['No','Yes'][s=='NS'or s=='EW'or s=='ENSW'])

Solution (Python):
S = set(list(input()))
if ('S' in S and 'N' not in S) or ('N' in S and 'S' not in S) or ('W' in S and 'E' not in S)or ('E' in S and 'W' not in S):
        print("No")
else:
        print('Yes')

Solution (Python):
S = input()
w = S.count('W')
e = S.count('E')
n = S.count('N')
s = S.count('S')
if (w and not e) or (e and not w) or (n and not s) or (s and not n):
    print("No")
else:
    print("Yes")

Solution (Python):
S = input()
if 'N' in S and 'S' not in S: print('No')
elif 'S' in S and 'N' not in S: print('No')
elif 'W' in S and 'E' not in S: print('No')
elif 'E' in S and 'W' not in S: print('No')
else: print('Yes')

Solution (Python):
S = input()
s = list(set(S))
if s.count('S') == s.count('N') and s.count('E') == s.count('W'):
  print('Yes')
else:
  print('No')

Solution (Python):
S = input()
n,w,s,e = 0,0,0,0
for i in S:
    if i == "N":
        n = 1
    if i == "W":
        w = 1
    if i == "S":
        s = 1
    if i == "E":
        e = 1

if n == s and w == e:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys
input = sys.stdin.readline
SS = list(input())

if 'N' in SS:
    if not 'S' in SS:
        print('No')
        exit()
if 'S' in SS:
    if not 'N' in SS:
        print('No')
        exit()
if 'W' in SS:
    if not 'E' in SS:
        print('No')
        exit()
if 'E' in SS:
    if not 'W' in SS:
        print('No')
        exit()
print('Yes')

Solution (Python):
s=input()
ans=[0]*4
check='NWSE'
for i in range(len(s)):
  for j in range(len(check)):
    if s[i]==check[j]:
      ans[j]+=1
if ans[0]!=0 and ans[2]!=0 and ans[1]!=0 and ans[3]!=0:
  print('Yes')
elif ans[0]!=0 and ans[2]!=0 and ans[1]==0 and ans[3]==0:
  print('Yes')
elif ans[0]==0 and ans[2]==0 and ans[1]!=0 and ans[3]!=0:
  print('Yes')
else:
  print('No')

Solution (Python):
S = set(list(input()))
if len(S) == 4: print("Yes")
elif len(S) == 2:
    if S == {"N", "S"} or S == {"E", "W"}: print("Yes")
    else:print("No")
else: print("No")

Solution (Python):
S=input()
n=S.count('N')
s=S.count('S')
e=S.count('E')
w=S.count('W')
if (n >= 1 and s >= 1) or (n == 0 and s == 0):
  if (e >= 1 and w >= 1) or (e == 0 and w == 0):
    print('Yes')
    exit()
print('No')

Solution (Python):
s=input()
ans='No'
y='Yes'
if ('N' in s and 'S' in s) or ('N' not in s and 'S' not in s):
    if ('E' in s and 'W' in s) or ('E' not in s and 'W' not in s):
        ans=y
print(ans)

Solution (Python):
S = input()
N = len(S)
d = [0,0,0,0]
s = ['N','W','S','E']
for i in range(N):
    for j in range(4):
        if S[i] == s[j]:
            d[j] += 1
            break

flag = True
if (d[0] == 0 and d[2] == 0) or (d[0] != 0 and d[2] != 0):
    pass
else:
    flag = False
if (d[1] == 0 and d[3] == 0) or (d[1] != 0 and d[3] != 0):
    pass
else:
    flag = False
    
if flag:
    print('Yes')
else:
    print('No')

Solution (Python):
S = input()

s = set(S[:])
ans = s == set(["N", "W", "S", "E"]) or s == set(["N", "S"]) or s == set(["W", "E"])

print("Yes" if ans else "No")

Solution (Python):
s=set(list(input()))
if "S" in s:
    if not "N" in s:
        print("No")
        exit()
if "N" in s:
    if not "S" in s:
        print("No")
        exit()
if "E" in s:
    if not "W" in s:
        print("No")
        exit()
if "W" in s:
    if not "E" in s:
        print("No")
        exit()
print("Yes")

Solution (Python):
a=input()
ans="Yes"
if "W"in a and"E"not in a:
  ans="No"
elif "E"in a and"W"not in a:
  ans="No"
elif "N"in a and"S"not in a:
  ans="No"
elif "S"in a and"N"not in a:
  ans="No"
print(ans)

Solution (Python):
s = list(set(list(input())))
print("Yes" if s.count('N') == s.count('S') and s.count('E') == s.count('W') else "No")

Solution (Python):
S = input()
flag = 1
if S.count("W") == 0 and S.count("E") == 0:
  if S.count("N") == 0 or S.count("S") == 0:
    flag = 0
  else:
    flag = 1
elif S.count("W") == 0 or S.count("E") == 0:
  flag = 0
elif S.count("N") == 0 and S.count("S") == 0:
  flag = 1
elif S.count("N") == 0 or S.count("S") == 0:
  flag = 0
else:
  flag = 1
if flag == 1:
  print("Yes")
else:
  print("No")

Solution (Python):


s = set(input())
ans = 0
for i in s:
    if 'N' in i:
        ans += 1
    elif 'W' in i:
        ans += -2
    elif 'S' in i:
        ans += -1
    else:
        ans += 2
print('Yes' if ans == 0 else 'No')

Solution (Python):


s=set(input())
if s in [{'W','E'},{'N','S'},{'N','E','W','S'}]:
  print('Yes')
else:
  print('No')

Solution (Python):
s = input()

N = 'N' in s
S = 'S' in s
E = 'E' in s
W = 'W' in s

if N ^ S or E ^ W:
    print("No")
else:
    print("Yes")

Solution (Python):
s = input()
print('No' if len([x for x in [[s.count('N'), s.count('S')], [s.count('W'), s.count('E')]] if x.count(0) == 1]) else 'Yes')

Solution (Python):
s=input();ans=0
if"N"in s:ans+=1
if"S"in s:ans-=1
if"E"in s:ans+=2
if"W"in s:ans-=2
print("Yes"if ans==0else"No")

Solution (Python):
S = input()
flagNS = (('N' in S) == ('S' in S))
flagEW = (('E' in S) == ('W' in S))

print("Yes" if flagNS and flagEW else "No")

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007
sys.setrecursionlimit(1000000)


def A():
    s = S()
    a = s.count("a")
    b = s.count("b")
    c = 3-a-b
    if a&b&c:
        print("Yes")
    else:
        print("No")

def B():
    a,b,k = LI()
    ans = []
    for i in range(a,min(a+k,b+1)):
        ans.append(i)
    for i in range(max(a,b-k+1),b+1):
        ans.append(i)
    ans = list(set(ans))
    ans.sort()
    for i in ans:
        print(i)


def C():
    a,b,c = LI()
    ans = 0
    if a%2:
        if b%2:
            if not c%2:
                ans += 1
                a += 1
                b += 1
        else:
            ans += 1
            if not c%2:
                b += 1
                c += 1
            else:
                a += 1
                c += 1
    else:
        if b%2:
            ans += 1
            if not c%2:
                a += 1
                c += 1
            else:
                b += 1
                c += 1
        else:
            if c%2:
                ans += 1
                a += 1
                b += 1
    ans += (3*max(a,b,c)-a-b-c)//2
    print(ans)

def D():
    q = I()
    for i in range(q):
        a,b = LI()
        x = int((a*b)**0.5)
        y = math.ceil((a*b)/x)-1
        ans = x+y-2
        if a==b:
            ans += 1
        print(ans)


def E():
    s = S()
    f = {"N":0,"W":0,"S":0,"E":0}
    for i in s:
        f[i] = 1
    if f["N"]^f["S"]:
        print("No")
    elif f["W"]^f["E"]:
        print("No")
    else:
        print("Yes")

def F():
    return


def G():
    return


def H():
    return


if __name__ == "__main__":
    E()

Solution (Python):
print('NYoe s'[set(input())in map(set,['','NS','EW','NSEW'])::2])

Solution (Python):
S=set(input())
print('Yes'if S in [{'N','S'},{'E','W'}]or len(S)%4==0 else'No')

Solution (Python):
S = input()
if "N" in S and "S" in S:
    if ("W" in S and "E" in S) or ("W" not in S and "E" not in S):
        print("Yes")
    else:
        print("No")
elif "N" in S or "S" in S:
    print("No")
else:
    if "W" in S and "E" in S:
        print("Yes")
    else:
        print("No")

Solution (Python):
s = list(set(list(input())))
s.sort()
if len(s) == 4:
    print('Yes')
elif len(s) == 2:
    if s[0] + s[1] == 'NS' or s[0] + s[1] == 'EW':
        print('Yes')
    else:
        print('No')
else:
    print('No')

Solution (Python):
S = input()
X = ['N' in S, 'S' in S, 'W' in S, 'E' in S]
print('Yes' if X[0]==X[1] and X[2]==X[3] else 'No')

Solution (Python):
S = input()
X = ['N' in S, 'S' in S]
Y = ['W' in S, 'E' in S]
flg = False
if X[0]==X[1] and Y[0]==Y[1]:
    flg = True
print('Yes' if flg else 'No')

Solution (Python):

'''
問題
座標平面上に家がある
長さNの文字列Sがある
文字列の各文字はNWSEのいずれか
i文字目の示す方向にしたがって任意の距離だけ移動することをNターン繰り返す
うまく移動距離を決めることで，Nターン終了後にふたたび家に戻っていることができるか？
Sの長さは1以上1000以下
各ターンでの移動距離は必ず正にすること

考察
1.NとSのうち両方がSに含まれるか，またはどちらも含まれない
2.WとEのうち両方がSに含まれるか，またはどちらも含まれない
この2つが同時に満たされていればよい

1.は次の条件と同値:
S.count('N')*S.count('S')>0 or
(S.count('N')==0 and S.count('S')==0)
'''

S = str(input())

if ((('N' in S) and ('S' in S)) or (('N' not in S) and ('S' not in S))) and ((('W' in S) and ('E' in S)) or (('W' not in S) and ('E' not in S))):
	print('Yes')
else:
	print('No')

Solution (Python):
s=set(input())
if s in [{'W','E'},{'N','S'},{'N','E','W','S'}]:
  print('Yes')
else:
  print('No')

Solution (Python):
from collections import Counter
s=input()
cnt=Counter(s)
result=True
if cnt.get("N",False) or cnt.get("S",False):
    if cnt.get("N",False) and cnt.get("S",False):
        pass
    else:
        result=False
if cnt.get("E",False) or cnt.get("W",False):
    if cnt.get("E",False) and cnt.get("W",False):
        pass
    else:
        result=False
print("Yes" if result else "No")

Solution (Python):
T = input() 
N = T.count("N")
S = T.count("S")
E = T.count("E")
W = T.count("W")

if (N>0 and S==0) or (S>0 and N==0) or (W>0 and E==0) or (E>0 and W==0):  
    print("No")
else:
    print("Yes")

Solution (Python):
n = list(input())
a = [0,0,0,0]
for i in range(len(n)):
  if n[i] =="W":
    a[0] += 1
  elif n[i] == "E":
    a[1] += 1
  elif n[i] == "N":
    a[2] += 1
  elif n[i] == "S":
    a[3] += 1
if a[0]*a[1] * a[2]*a[3] != 0 or (a[0]+a[1] == 0 and (a[2]*a[3]) != 0)or(a[2]+a[3] == 0 and (a[0]*a[1]) != 0):
  print("Yes")
else:
  print("No")

Solution (Python):
s = input()
print("Yes" if ('N' in s) == ('S' in s) and ('W' in s) == ('E' in s) else "No")

Solution (Python):
S = list(input())

if S.count('S')!=0 and S.count('N')== 0:
  print('No')
elif S.count('N')!=0 and S.count('S')== 0:
  print('No')
elif S.count('E')!=0 and S.count('W')== 0:
  print('No')
elif S.count('W')!=0 and S.count('E')== 0:
  print('No')
else:
  print('Yes')

Solution (Python):
S=input()
v=S.count('N')==S.count('S') or S.count('N')*S.count('S')>0
h=S.count('E')==S.count('W') or S.count('E')*S.count('W')>0

if v and h:
  print('Yes')
else:
  print('No')

Solution (Python):
s = input()

N_in = ('N' in s)
S_in = ('S' in s)
E_in = ('E' in s)
W_in = ('W' in s)

bl = ((N_in and S_in) or (not N_in and not S_in)) and ((E_in and W_in) or (not E_in and not W_in))

print('Yes' if bl else 'No')

Solution (Python):
S = list(input())
if ('S' in S and 'N' not in S) or ('N' in S and 'S' not in S)or ('W' in S and 'E' not in S)or ('E' in S and 'W' not in S):
        print("No")
else:
        print('Yes')

Solution (Python):
s=list(input())

E=0
W=0
N=0
S=0

for i in range(len(s)):
    if s[i]=="E":
        E=1
    elif s[i]=="W":
        W=1
    elif s[i]=="N":
        N=1
    elif s[i]=="S":
        S=1
if E==W and N==S:
    print("Yes")
else:
    print("No")