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):
def myAnswer(S:list)->str:
   dic ={"W":0,"N":0,"E":0,"S":0}
   for s in S:
      dic[s]+=1
   if(min(dic["W"],dic["E"])==0 and max(dic["W"],dic["E"])>=1):
      return "No"
   elif(min(dic["N"],dic["S"])==0 and max(dic["N"],dic["S"])>=1):
      return "No"
   else:
      return "Yes"

def modelAnswer():
   tmp=1
def main():
   S = list(input())
   print(myAnswer(S[:]))

if __name__ == '__main__':
   main()

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

Solution (Python):
def solve(s):
    for dirs in ('NS', 'SN', 'EW', 'WE'):
        d, o = dirs[0], dirs[1]
        if d in s and o not in s:
            return False
    return True


s = input()
print('Yes' if solve(s) else 'No')

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

Solution (Python):
from collections import Counter
s = input()
c = Counter(s)

if len(c) == 4:
    print('Yes')
elif len(c) == 3:
    print('No')
elif len(c) == 1:
    print('No')
elif len(c) == 2:
    if c['N'] > 0 and c['S'] > 0:
        print('Yes')
    elif c['W'] > 0 and c['E'] > 9:
        print('Yes')
    else:
        print('No')

Solution (Python):
i=set(input())
if i=={"E","N","S","W"} or i=={"N","S"} or i=={"E","W"}:
    print("Yes")
else:
    print("No")

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

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

print('Yes')

Solution (Python):
i=input()
n,s,w,e=map(lambda x: min(1,i.count(x)),"NSWE")
print("YNeos"[(n^s)|(w^e)::2])

Solution (Python):
i = input()
n, s, w, e = map(lambda x: min(1, i.count(x)), "NSWE")
print(["Yes","No"][(n ^ s)|(w ^ e)])

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

if set(s)=={'S','N'} or set(s)=={'W','E'} or set(s)=={'S','N','W','E'}:
    print("Yes")
else:
    print("No")

Solution (Python):
s = input()

dicts = {'N':0, 'S':0, 'W':0, 'E':0}
for i in s:
    dicts[i] += 1

if dicts['N'] != 0 and dicts['S'] == 0 or dicts['N'] == 0 and dicts['S'] != 0:
    print('No')
elif dicts['W'] != 0 and dicts['E'] == 0 or dicts['W'] == 0 and dicts['E'] != 0:
    print('No')
else:
    print('Yes')

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

Solution (Python):
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math

s = input()
cnt = [0]*4
for i in range(len(s)):
    if s[i] == "N":
        cnt[0] = 1
    elif s[i] == "W":
        cnt[1] = 1
    elif s[i] == "E":
        cnt[2] =1
    else:
        cnt[3] =1

if cnt[0]^cnt[3] == 1 or cnt[1]^cnt[2] == 1:
    print("No")
else:
    print("Yes")

Solution (Python):
S = input()

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

Solution (Python):
S = input()
x = y = 0
n = w = s = e = 0
for c in S:
  if c == 'N':
    n += 1
  elif c == 'W':
    w += 1
  elif c == 'S':
    s += 1
  else:
    e += 1
if (n == 0 and s > 0) or (s == 0 and n > 0):
  y = 1
if (w == 0 and e > 0) or (e == 0 and w > 0):
  x = 1
print('Yes' if x == 0 and y == 0 else 'No')

Solution (Python):
S = input()

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

if len(direct) == 4:
    print("Yes")
elif (len(direct) == 2) and ('N' in direct) and ('S' in direct):
    print("Yes")
elif (len(direct) == 2) and ('E' in direct) and ('W' in direct):
    print("Yes")
else:
    print("No")

Solution (Python):
s = input()
cnt = {'N':0,'S':0,'E':0,'W':0}
ok = True
for x in s:
    cnt[x] +=1
if ((cnt['N'] >0)^(cnt['S']>0)) == 1:ok = False
if ((cnt['E'] >0)^(cnt['W']>0)) == 1:ok = False
if ok:print('Yes')
else:print('No')

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

Solution (Python):
S = input()
North = S.count("N")
South = S.count("S")
East = S.count("E")
West = S.count("W")
if ((North > 0 and South > 0) or (North == 0 and South == 0)) and ((East > 0 and West > 0) or (East == 0 and West == 0)):
    print("Yes")
else:
    print("No")

Solution (Python):
s = input()

sn = not ('N' in s)^('S' in s)
ew = not ('E' in s)^('W' in s)

if sn and ew:
    print('Yes')
else:
    print('No')

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

d = {}
for i in range(len(s)):
    d[s[i]] = d.get(s[i], 0)+1

ans = 0
if 'N' in d:
    ans += 1
if 'S' in d:
    ans -= 1
if 'E' in d:
    ans += 100
if 'W' in d:
    ans -= 100
if ans == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
i=set(input())
if i=={"E","N","S","W"} or i=={"N","S"} or i=={"E","W"}:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt
from functools import lru_cache, reduce
INF = 1 << 60
mod = 1000000007
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

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

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def dijkstra_heap(s, edge, n):
    
    d = [10**20] * n
    used = [True] * n 
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


def lcm(x, y):
    return (x * y) // gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm, numbers, 1)


def gcd_list(numbers):
    return reduce(gcd, numbers)


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

Solution (Python):
from collections import defaultdict
s=input()
cnt=defaultdict(lambda :0)

for i in s:
    cnt[i]+=1

if cnt['N']*cnt['S']==0 and (cnt['N']+cnt['S'])>0:
    print('No')
elif cnt['E']*cnt['W']==0 and (cnt['E']+cnt['W'])>0:
    print('No')
else:
    print('Yes')

Solution (Python):
S = input()
C = dict([[s, False] for s in 'NWSE'])
for s in S:
    C[s] = True

print('Yes' if C['W'] == C['E'] and C['S'] == C['N'] else 'No')

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

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

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()

x = defaultdict(int)
for s in S:
	x[s] = 1
if x["N"] == x["S"] and x["W"] == x["E"]:
	print("Yes")
else:
	print("No")

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

s_unique = list(s_set)
s_unique.sort()

s_unique_len = len(s_unique)

if s_unique_len == 4:
  print('Yes')
elif s_unique_len == 2:
  if s_unique[0] == 'E' and s_unique[1] == 'W':
    print('Yes')
  elif s_unique[0] == 'N' and s_unique[1] == 'S':
    print('Yes')
  else:
    print('No')
else:
  print('No')

Solution (Python):
s = list(input())
v = ["N", "W", "S", "E"]
a, b = 0, 0
for i in range(4):
    if v[i] in s:
        if i % 2 == 0:
            a += 1
        else:
            b += 1
print("Yes" if a % 2 == b % 2 == 0 else "No")

Solution (Python):
K = input()

K_S =K.count("S")
K_N =K.count("N")
K_W =K.count("W")
K_E =K.count("E")

if ((K_S != 0) and (K_N == 0)) or \
((K_E != 0) and (K_W == 0)) or \
((K_N != 0) and (K_S == 0)) or \
((K_W != 0) and (K_E == 0)):
  print("No")
else:
  print("Yes")

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

S.sort()

flag = 1

if 'N' in S:
    if 'S' not in S:
        flag = 0

if 'S' in S:
    if 'N' not in S:
        flag = 0

if 'E' in S:
    if 'W' not in S:
        flag = 0

if 'W' in S:
    if 'E' not in S:
        flag = 0

if flag:
    print('Yes')

else:
    print('No')

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

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

Solution (Python):

s = list(input())



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

Solution (Python):
S = input()
d = {}

for s in S:
  d[s] = True

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

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

Solution (Python):
def resolve():

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

resolve()

Solution (Python):
from collections import Counter
S = Counter(input())

def isNotOk():
    WE = (S['W'] > 0) ^ (S['E'] > 0)
    NS = (S['N'] > 0) ^ (S['S'] > 0)
    return WE or NS

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

Solution (Python):

import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

S = input()
C = collections.Counter(S)
if (C["N"] and not C["S"]) or ((not C["N"]) and C["S"]) or  (C["W"] and not C["E"]) or ((not C["W"]) and C["E"]):
  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 = set(input())

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

Solution (Python):
s = str(input())
d = {}
d['N'] = 0
d['W'] = 0
d['S'] = 0
d['E'] = 0
flag1 = False
flag2 = False

for i in range(len(s)):
    if s[i] == 'N' or s[i] == 'S':
        flag1 = True
        d[s[i]] = 1
    if s[i] == 'W' or s[i] == 'E':
        flag2 = True
        d[s[i]] = 1

if flag1:
    if d['N'] == 0 or d['S'] == 0:
        print('No')
        exit()

if flag2:
    if d['W'] == 0 or d['E'] == 0:
        print('No')
        exit()

print('Yes')

Solution (Python):
S = list(input())
ans = "Yes"
if S.count("W") > 0:
  if "E" not in S: ans = "No"
if S.count("E") > 0:
  if "W" not in S: ans = "No"
if S.count("N") > 0:
  if "S" not in S: ans = "No"
if S.count("S") > 0:
  if "N" not in S: ans = "No"
print(ans)

Solution (Python):
S = input()
Flags = [False] * 4
for s in S:
    if "N" == s:
        Flags[0] =True
    elif "S" == s:
        Flags[1] =True
    elif "W" == s:
        Flags[2] =True
    elif "E" == s:
        Flags[3] =True

if all(Flags) or (Flags[0] and Flags[1] and not Flags[2] and not Flags[3]) or \
        (Flags[2] and Flags[3] and not Flags[0] and not Flags[1]):
    print("Yes")
else:
    print("No")

Solution (Python):
from collections import Counter
s = list(input())
ans = Counter(s)
flag = False
if 'S' in ans:
    if 'E' in ans:
        if 'N' in ans:
            if 'W' in ans:
                flag = True
    else:
        if 'W' not in ans:
            if 'N' in ans:
                flag = True
else:
    if 'N' not in ans:
        if 'E' in ans:
            if 'W' in ans:
                flag = True
print('Yes' if flag==True else 'No')

Solution (Python):
from collections import*
s=input()

c=Counter(s)

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

Solution (Python):
if __name__ == "__main__":
    s = input()

    p = set(s)

    if len(p) % 2 == 1:
        print('No')
        exit()

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

Solution (Python):
S=input()
n=w=s=e=0
for c in S:
    if c =='N': n=1
    elif c=='W': w=1
    elif c=='S': s=1
    elif c=='E': e=1
print('Yes' if n==s and w==e else 'No')

Solution (Python):
import sys
input = sys.stdin.readline
S = list(input())[: -1]
n = S.count("N") > 0
e = S.count("E") > 0
s = S.count("S") > 0
w = S.count("W") > 0
if n and s or (n == 0 and (s == 0)):
  if e and w or (e == 0 and (w == 0)):
    print("Yes")
    exit(0)
print("No")

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

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = False

s = list(STR())
flag = True
if s.count('N') and not s.count('S'):
    flag = False
if s.count('E') and not s.count('W'):
    flag = False
if not s.count('N') and s.count('S'):
    flag = False
if not s.count('E') and s.count('W'):
    flag = False
if flag:
    print('Yes')
else:
    print('No')

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

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

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):

from collections import Counter
def inputlist(): return [int(j) for j in input().split()]

S = list(input())
c = Counter(S)
news = ['N','E','W','S']
sa = set(S)
if sa == {'N','S'} or sa == {'E','W'}:
    print("Yes")
    exit()
for i in range(4):
    if c[news[i]] == 0:
        print("No")
        exit()
print("Yes")

Solution (Python):
S = input()

n = 'N' in S
s = 'S' in S
e = 'E' in S
w = 'W' in S

if (n and s) or (n==False and s==False):
    if (e and w) or (e==False and w==False):
        print('Yes')
    else:
        print('No')
else:
    print('No')

Solution (Python):
s=input()

if s.count("N")==0 and s.count("S")==0:
    if s.count("W")>=1 and s.count("E")>=1:
        print("Yes")
        exit()

if s.count("W")==0 and s.count("E")==0:
    if s.count("N")>=1 and s.count("S")>=1:
        print("Yes")
        exit()

if s.count("W")>=1 and s.count("E")>=1 and s.count("N")>=1 and s.count("S")>=1:
    print("Yes")
    exit()

print("No")

Solution (Python):
a = input()
v = 0
h = 0
if a.count('W') >=1:
  if a.count('E') ==0:
    print('No')
    exit()
if a.count('E') >=1:
  if a.count('W') ==0:
    print('No')
    exit()
if a.count('N')>= 1:
  if a.count('S') ==0:
    print('No')
    exit()
if a.count('S')>= 1:
  if a.count('N')==0:
    print('No')
    exit()
print('Yes')

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

s = set(s)

if len(s) % 2 == 0 and (("S" in s and "N" in s) or ("E" in s and "W" in s)):
    print("Yes")
else:
    print("No")

Solution (Python):
S = str(input())
ans = True
if ('N' in S) ^ ('S' in S) == 1:
  ans = False
if ('E' in S) ^ ('W' in S) == 1:
  ans = False
if ans: print('Yes')
else: print('No')

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

Solution (Python):
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') 
def gcd(a,b):return fractions.gcd(a,b) 
def lcm(a,b):return (a*b) // fractions.gcd(a,b) 
def iin(): return int(sys.stdin.readline()) 
def ifn(): return float(sys.stdin.readline()) 
def isn(): return sys.stdin.readline().split() 
def imn(): return map(int, sys.stdin.readline().split()) 
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) 
def fmn(): return map(float, sys.stdin.readline().split()) 
def iln(): return list(map(int, sys.stdin.readline().split())) 
def iln_s(): return sorted(iln()) 
def iln_r(): return sorted(iln(), reverse=True) 
def fln(): return list(map(float, sys.stdin.readline().split())) 
def join(l, s=''): return s.join(l) 
def perm(l, n): return itertools.permutations(l, n) 
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) 
def comb(l, n): return itertools.combinations(l, n) 
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) 
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 
def m_add(a,b): return (a+b) % MOD
def print_list(l): print(*l, sep='\n')

def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

S = set(input())

if ('N' in S) != ('S' in S):
    print('No')
elif ('W' in S) != ('E' in S):
    print('No')
else:
    print('Yes')

Solution (Python):
S = input()

cN, cS, cW, cE = 0, 0, 0, 0
for ch in S:
    if ch == 'E':
        cE += 1
    elif ch == 'W':
        cW += 1
    elif ch == 'S':
        cS += 1
    else:
        cN += 1


















if (cW > 0 and cE == 0) or (cW == 0 and cE > 0) or \
    (cS > 0 and cN == 0) or (cS == 0 and cN > 0):
    print("No")
else:
    print("Yes")

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

Solution (Python):
s = set(list(input()))
ans = 'Yes'
if ('N' in s)!=('S' in s) or ('W' in s)!=('E' in s):ans = 'No'
print(ans)

Solution (Python):
s = set(list(input()))
ans = 'Yes'
if ('N' in s)!=('S' in s):ans = 'No'
elif ('W' in s)!=('E' in s):ans = 'No'
print(ans)

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

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

Solution (Python):
import collections
s = set(list(input()))
ans = 'Yes'
if 'N' in s and not 'S' in s or 'S' in s and not 'N' in s:
    ans = 'No'
elif 'W' in s and not 'E' in s or 'E' in s and not 'W' in s:
    ans = 'No'
print(ans)

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

Solution (Python):
from collections import Counter
s = [s for s in input()]
cnt = Counter(s)
if "N" in cnt.keys() or "S" in cnt.keys():
    if "N" not in cnt.keys() or "S" not in cnt.keys():
        print("No")
        exit()
if "W" in cnt.keys() or "E" in cnt.keys():
    if "W" not in cnt.keys() or "E" not in cnt.keys():
        print("No")
        exit()
print("Yes")

Solution (Python):
def main():
    from collections import Counter
    s = list(input())
    a = 'E' in s
    b = 'W' in s
    c = 'N' in s
    d = 'S' in s

    if not (a ^ b) and not (c ^ d):
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

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

if (f["N"] ^ f["S"]):
    print("No")
elif (f["W"] ^ f["E"]):
    print("No")
else:
    print("Yes")

Solution (Python):
S=input()

ans="No"
n=0
w=0
e=0
s=0
tate=0
yoko=0

for str in S:
  if str=="N":
    n +=1
  elif str=="E":
    e +=1
  elif str=="S":
    s +=1
  else:
    w +=1

if (n>0 and s>0) or (n==0 and s==0):
  tate=True
if (e>0 and w>0) or (e==0 and w==0):
  yoko=True
  
if tate and yoko:
  ans="Yes"
  
print(ans)

Solution (Python):
S = input()


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

Solution (Python):
s=input()
scnt,ncnt,wcnt,ecnt=0,0,0,0
for i in range(len(s)):
    if(s[i]=='S'):
        scnt+=1
    elif(s[i]=='N'):
        ncnt+=1
    elif(s[i]=='E'):
        ecnt+=1
    elif(s[i]=='W'):
        wcnt+=1
if((scnt!=0 and ncnt==0) or (scnt==0 and ncnt!=0) or (wcnt>0 and ecnt==0) or (wcnt==0 and ecnt>0)):
    print("No")
else:
    print("Yes")

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

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

Solution (Python):
S = input()
bit = 0
for i in S:
  if i == 'N':
    bit |= 1
  elif i == 'E':
    bit |= 2
  elif i == 'S':
    bit |= 4
  elif i == 'W':
    bit |= 8
  if bit == 15:
    break
if bit % 5 == 0:
  print('Yes')
else:
  print('No')

Solution (Python):
def main():
    direction = input()
    now = [0, 0]
    dir_count = {"N": 0, "E": 0, "S": 0, "W": 0}
    for d in direction:
        dir_count[d] += 1
        if d == "N":
            now[0] += 1
        elif d == "E":
            now[1] += 1
        elif d == "S":
            now[0] -= 1
        else:
            now[1] -= 1
    answer = False
    if ((now[1] < 0 and 0 < dir_count["E"]) or (0 < now[1] and 0 < dir_count["W"]) or now[1] == 0) and \
            ((now[0] < 0 and 0 < dir_count["N"]) or (0 < now[0] and 0 < dir_count["S"]) or now[0] == 0):
        answer = True
    print("Yes" if answer else "No")


if __name__ == '__main__':
    main()

Solution (Python):
st = input()
sn = len(st)

n, s, e, w = 0, 0, 0, 0
for i in range(sn):
  if st[i] == "N":
    n += 1
  if st[i] == "S":
    s += 1
  if st[i] == "E":
    e += 1
  if st[i] == "W":
    w += 1

false = (n > 0 and s == 0) or (s > 0 and n == 0) or (e > 0 and w == 0) or (w > 0 and e == 0)
if false:
  print("No")
else:
  print("Yes")

Solution (Python):
from collections import Counter

S = list(input())

c = Counter(S)
flag1 = False
flag2 = False
if "S" in c and "N" in c:
    flag1 = True
elif "S" not in c and "N" not in c:
    flag1 = True

if "W" in c and "E" in c:
    flag2 = True
elif "W" not in c and "E" not in c:
    flag2 = True

if flag1 and flag2:
    print("Yes")
else:
    print("No")

Solution (Python):
from collections import Counter

S = Counter(list(input()))

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

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

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    N = I()
    S = [I()for _ in range(N)]

    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**6)

if __name__ == '__main__':
    examA()

"""

"""

Solution (Python):

import sys

def INT(): return int(input())
def MAP(): return map(int,input().split())
def LI(): return list(map(int,input().split()))

def main():
    travel_plan = input()
    S = 0
    W = 0
    N = 0
    E = 0
    for t in travel_plan:
        if t == "S":
            S += 1
        elif t == "W":
            W += 1
        elif t == "N":
            N += 1
        else:
            E += 1
    
    if S*N == 0 and S+N != 0:
        print('No')
        return
    
    if W*E == 0 and W+E != 0:
        print('No')
        return
    
    print('Yes')
    return

if __name__ == '__main__':
    main()

Solution (Python):
S=input()
L=[S.count("N"),S.count("S"),S.count("W"),S.count("E")]
if L[0:2].count(0)==1 or L[2:].count(0)==1:
    print("No")
else:
    print("Yes")

Solution (Python):
s = input()

if "N" in s and "S" not in s\
    or "S" in s and "N" not in s\
    or "E" in s and "W" not in s\
    or "W" in s and "E" not in s:
    ans = "No"
else:
    ans = "Yes"

print(ans)

Solution (Python):
s = input()
count = [0, 0, 0, 0]
for i in range(len(s)):
  if s[i] == "N":
    count[0] = 1
  if s[i] == "S":
    count[1] = 1
  if s[i] == "W":
    count[2] = 1
  if s[i] == "E":
    count[3] = 1
if (count[0] + count[1])%2 or (count[2] + count[3])%2:
  print("No")
else:
  print("Yes")

Solution (Python):
ss = input()
n = 1
w = 1
s = 1
e = 1

if "N" in ss:
  n = -1
if "W" in ss:
  w = -1
if "S" in ss:
  s = -1
if "E" in ss:
  e = -1
if n*s + w*e > 0:
  print("Yes")
else:
  print("No")