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="".join(sorted(set([str(i) for i in input()])))
print("Yes" if s=="ENSW" or s=="EW" or s=="NS" else "No")

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

Solution (Python):

S =input()
n = 0
w = 0
s = 0
e = 0
for i in range(len(S)):
    if S[i] == "N":
        n += 1
    elif S[i] == "W":
        w += 1
    elif S[i] == "S":
        s += 1
    else:
        e += 1



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

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

    s = set(s)

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

Solution (Python):
S = input()
l = list(set(S))
if len(l) == 0:
    print("Yes")
elif len(l) % 2 == 1 :
    print("No")
else :
    if ("N" in l and "S" in l) or ("W" in l and "E" in l) :
        print("Yes")
    else :
        print("No")

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

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

Solution (Python):
def main():
    s = input().rstrip()
    N, W, S, E = 0, 0, 0, 0
    for c in s:
        if c == "N":
            N += 1
        if c == "W":
            W += 1
        if c == "S":
            S += 1
        if c == "E":
            E += 1
    if (N==0 and S>0) or (N>0 and S==0) or (W==0 and E>0) or (W>0 and E==0):
        print("No")
    else:
        print("Yes")

if __name__ == "__main__":
    main()

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

Solution (Python):
s = input()
sets = set()
for v in s:
    sets.add(v)
    
ans = "Yes"
if "N" in sets and "S" not in sets:
    ans = "No"
if "S" in sets and "N" not in sets:
    ans = "No" 
if "E" in sets and "W" not in sets:
    ans = "No" 
if "W" in sets and "E" not in sets:
    ans = "No"    
print(ans)

Solution (Python):
def solve():
  s = input()
  can = True
  isn = "N" in s
  isw = "W" in s
  iss = "S" in s
  ise = "E" in s
  if isn or iss:
    if isn and iss:
      pass
    else:
      print("No")
      exit()
  if isw or ise:
    if isw and ise:
      pass
    else:
      print("No")
      exit()
  print("Yes")
  
solve()

Solution (Python):
S = input()
dic_S = {}
flag  = True
for i in range(len(S)):
    if S[i] in dic_S:
        dic_S[S[i]] += 1
    else:
        dic_S[S[i]] = 1
dic_ans = {"N":"S", "W":"E", "S":"N", "E":"W"}
for k, v in dic_S.items():
    if v>=1:
        if dic_ans[k] not in dic_S:
            flag = False
            break
print("Yes") if flag else print("No")

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

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

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

Solution (Python):


S = input()
T = set(s for s in S)

print('No' if ('S' in T)^('N' in T) or ('E' in T)^('W' in T) else 'Yes')

Solution (Python):
S=input()
ecount=0
wcount=0
ncount=0
scount=0
flag=1
for i in range(len(S)):
    if S[i]=="E":
        ecount=ecount+1
    elif S[i]=="W":
        wcount=wcount+1
    elif S[i]=="N":
        ncount=ncount+1
    else:
        scount=scount+1
if (ncount>0)or(scount>0):
    if (ncount*scount==0):
        flag=0
if (wcount>0)or(ecount>0):
    if (wcount*ecount==0):
        flag=0
if flag==0:
    print("No")
else:
    print("Yes")

Solution (Python):
s=input()
ans="Yes"
cn=s.count("N")
cs=s.count("S")
ce=s.count("E")
cw=s.count("W")
if cn==0 and cs!=0:
    ans="No"
elif cn!=0 and cs==0:
    ans="No"
elif cw==0 and ce!=0:
    ans="No"
elif cw!=0 and ce==0:
    ans="No"
print(ans)

Solution (Python):
S = input()

n = 0
w = 0
s = 0
e = 0
for si in S:
    if si == 'N':
        n += 1
    elif si == 'W':
        w += 1
    elif si == 'S':
        s += 1
    else:
        e += 1


ans = False
if (n and s) or (not n and not s):
    if (w and e) or (not w and not e):
        ans = True

if ans:
    print('Yes')
else:
    print('No')

Solution (Python):
S=input()
print("YNeos"[(S.find("N")>=0)^(S.find("S")>=0) or (S.find("W")>=0)^(S.find("E")>=0)::2])

Solution (Python):
s = input()
f = True

if s.find("S") != -1 and s.find("N") == -1:
    f = False
if s.find("S") == -1 and s.find("N") != -1:
    f = False
if s.find("E") != -1 and s.find("W") == -1:
    f = False
if s.find("E") == -1 and s.find("W") != -1:
    f = False
print("Yes" if f else "No")

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

table = collections.defaultdict(int)
for x in S:
    table[x] += 1

N = False
W = False
E = False
S = False

if table["N"] > 0:
    N = True
if table["W"] > 0:
    W = True
if table["E"] > 0:
    E = True
if table["S"] > 0:
    S = True


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

Solution (Python):
from collections import Counter
def main():
    S = list(input())
    c = Counter(S)
    if ((c["N"] == 0 and c["S"] == 0) or (c["N"] > 0 and c["S"] > 0)) and ((c["W"] == 0 and c["E"] == 0) or (c["W"] > 0 and c["E"] > 0)):
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()

Solution (Python):
s=str(input())
if s.count("W")==0 and s.count("E")==0 and s.count("S")==0 and s.count("N")==0:
    print("Yes")
elif s.count("W")>0 and s.count("E")>0 and s.count("S")==0 and s.count("N")==0:
    print("Yes")
elif s.count("W")==0 and s.count("E")==0 and s.count("S")>0 and s.count("N")>0:
    print("Yes")
elif s.count("W")>0 and s.count("E")>0 and s.count("S")>0 and s.count("N")>0:
    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):
import sys

def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getlist():
    return list(map(int, input().split()))
import math
import heapq
from collections import defaultdict, Counter, deque
MOD = 10**9 + 7
INF = 10**15


def main():
    s = input().strip()
    p = 0
    if "N" in s:
        p += 1
    if "S" in s:
        p += 1
    if p == 1:
        print("No")
        return
    p = 0
    if "E" in s:
        p += 1
    if "W" in s:
        p += 1
    if p == 1:
        print("No")
        return
    
    print("Yes")
if __name__ == '__main__':
    main()

"""
9999
3

2916
"""

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"] or C["S"]) and C["N"]*C["S"] == 0):
  print("No")
elif ((C["W"] or C["E"]) and C["W"]*C["E"] == 0):
  print("No")
else:
  print("Yes")

Solution (Python):
s=list(input())
t=set(s)
flag=True
if len(t)==3 or len(t)==1:
  flag=False
if len(t)==2:
  if t!={'N','S'} and t!={'W','E'}:
    flag=False
print('Yes' if flag else 'No')

Solution (Python):
S = input()
C = [S.count("S"),S.count("N"),S.count("W"),S.count("E")]

if C[0]*C[1]*C[2]*C[3] > 0:
    print("Yes")
elif C[0] == C[1] == 0 and C[2]*C[3] > 0:
    print("Yes")
elif C[2] == C[3] == 0 and C[0]*C[1] > 0:
    print("Yes")
else:
    print("No")

Solution (Python):
from collections import defaultdict
S = input()
d = defaultdict(int)

for s in S:
    d[s] += 1


ans = "Yes"
if d["N"] > 0 and d["S"] == 0:
    ans = "No"
if d["S"] > 0 and d["N"] == 0:
    ans = "No"
if d["W"] > 0 and d["E"] == 0:
    ans = "No"
if d["E"] > 0 and d["W"] == 0:
    ans = "No"

print(ans)

Solution (Python):

s = list(str(input()))

tmp = list(set(s))
tmp.sort()
if len(tmp) == 2 and ((tmp[0] == 'E' and s[1] == 'W') or (tmp[0] == 'N' and tmp[1] == 'S')):
    print("Yes")
elif len(tmp) == 4:
    print("Yes")
else:
    print("No")

"""
if len(set(s)) == 1 or len(set(s)) == 3:
    print("No")
else:
    print("Yes")
"""

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

    tmp = set(s)

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

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

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

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

    print('Yes')

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

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

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


if __name__ == '__main__':
    main()

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

Solution (Python):
S = input()

ans = "Yes"
if "N" in S and "S" not in S:
        ans = "No"
if "S" in S and "N" not in S:
    ans = "No"
if "W" in S and "E" not in S:
    ans = "No"
if "E" in S and "W" not in S:
    ans = "No"
print(ans)

Solution (Python):
S=input()
x=set(S)
if len(x)%2==1:
  print('No')
else:
  if len(x)==4:
    print('Yes')
  else:
    if (('N' in S) and ('S' in S)) or (('E' in S) and ('W' in S)):
      print('Yes')
    else:
      print('No')

Solution (Python):
s = input()

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

Solution (Python):
s = input()
n_count = (1 if s.count('N')>=1 else 0)
s_count = (1 if s.count('S')>=1 else 0)
w_count = (1 if s.count('W')>=1 else 0)
e_count = (1 if s.count('E')>=1 else 0)
ns = not(n_count ^ s_count)
we = not(w_count ^ e_count)
if ns & we:
    print('Yes')
else:
    print('No')

Solution (Python):
s = input()

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

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

print("No")

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

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

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

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

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

print('Yes')

Solution (Python):
import sys
from collections import Counter
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

S = sr()
c = Counter(S)
bool = True
if (c['N']==0) ^ (c['S']==0):
    bool = False
if (c['E']==0) ^ (c['W']==0):
    bool = False

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

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())
NS = {"N", "S"}
EW = {"E", "W"}

if(len(S)%2 != 0):
    print("No")
else:
    if(len(S) == 4):
        print("Yes")
    else:
        if(NS == S or EW == S):
            print("Yes")
        else:
            print("No")

Solution (Python):
s = input()
chk = [0, 0, 0, 0]
for c in s:
    if c == 'N':
        chk[0] += 1
    elif c == 'S':
        chk[1] += 1
    elif c == 'W':
        chk[2] += 1
    else:
        chk[3] += 1

if chk[0] > 0:
    if chk[1] == 0:
        print("No")
        exit()
if chk[1] > 0:
    if chk[0] == 0:
        print("No")
        exit()
if chk[2] > 0:
    if chk[3] == 0:
        print("No")
        exit()
if chk[3] > 0:
    if chk[2] == 0:
        print("No")
        exit()
print("Yes")

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

Solution (Python):
from collections import Counter
C = Counter(input())
if ((C["N"] == 0 and C["S"] == 0) or (C["N"] != 0 and C["S"] != 0)) and ((C["W"] == 0 and C["E"] == 0) or (C["W"] != 0 and C["E"] != 0)):
    print("Yes")
else:
    print("No")

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

Solution (Python):
S = input()
S_set = set(S)
if S_set == set("WE") or S_set == set("NS") or S_set == set("WENS"):
	print("Yes")
else:
	print("No")

Solution (Python):
n, e, w, s = [0]*4
for i in input():
    if i=="N": n=1
    if i=="E": e=1
    if i=="W": w=1
    if i=="S": s=1
print("YNeos"[n!=s or e!=w::2])

Solution (Python):
S = input()
d = {'N': 0, 'W': 0, 'S': 0, 'E': 0}
prev = 'null'
for s_i in S:
    d[s_i] = 1
    if sum(d.values()) == 4:
        break
y = False
x = False
if (d['N'] and d['S']) or not(d['N'] or d['S']):
    y = True
if (d['W'] and d['E']) or not(d['W'] or d['E']):
    x = True
print('Yes' if y and x else 'No')

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

Solution (Python):
import sys
s = input()
south = 'S' in s
north = 'N' in s
east = 'E' in s
west = 'W' in s

f = lambda x, y : x and not y or y and not x

if f(south, north) or f(west, east):
  print("No")
else:
  print("Yes")

Solution (Python):
import sys
s = input()
south = s.count('S')
north = s.count('N')
east = s.count('E')
west = s.count('W')

f = lambda x, y : x == 0 and y != 0 or x != 0 and y == 0

if f(south, north) or f(west, east):
  print("No")
else:
  print("Yes")

Solution (Python):
s = input()
ans = 'Yes'
n = 0
w = 0
sow = 0
e = 0

for i in range(len(s)):
    if s[i] == 'N':
        n += 1
    elif s[i] == 'W':
        w += 1
    elif s[i] == 'S':
        sow += 1
    else:
        e += 1



if (n == 0 and sow != 0) or (n != 0 and sow == 0):
    ans = 'No'
if (w == 0 and e != 0) or (w != 0 and e == 0):
    ans = 'No'
print(ans)

Solution (Python):
S = input()

compass = list(S)
vertical = []
width = []
if "N" in compass:
    vertical.append(1)
if "S" in compass:
    vertical.append(-1)
if "W" in compass:
    width.append(1)
if "E" in compass:
    width.append(-1)

if sum(vertical) == 0 and sum(width) == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys

import collections

def main():
    S = str(input())
    c = collections.Counter(S)
    c = c.keys()
    if len(c) == 4:
        print("Yes")
    elif len(c) == 2:
        if ("S" in c and "N" in c):
            print("Yes")
        elif ("W" in c and "E" in c):
            print("Yes")
        else:
            print("No")
    else:
        print("No")

if __name__ == "__main__":
    main()

Solution (Python):
s = input()
print("No" 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)\
		   else "Yes")

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

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

Solution (Python):
import sys
s = input()
south = s.count('S')
north = s.count('N')
east = s.count('E')
west = s.count('W')

f = lambda x, y : x == 0 and y != 0

if f(south, north) or f(north, south) or f(east, west) or f(west, east):
  print("No")
else:
  print("Yes")

Solution (Python):

s = list(input())

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


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

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

a = ('N' in s) + ('S' in s)
b = ('W' in s) + ('E' in s)

if a == 1 or b == 1:
    print('No')
else:
    print('Yes')

Solution (Python):

ss=input()
n=ss.count('N')
w=ss.count('W')
s=ss.count('S')
e=ss.count('E')

ns=False
if n>0 and s>0:
    ns=True
elif n==0 and s>0:
    ns=False
elif n>0 and s==0:
    ns=False
elif n==0 and s==0:
    ns=True

we=False
if w>0 and e>0:
    we=True
elif w==0 and e>0:
    we=False
elif w>0 and e==0:
    we=False
elif w==0 and e==0:
    we=True

if ns==True and we==True:
    print('Yes')
else:
    print('No')

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

ans = True
if ("N" in S) and not("S" in S):
    ans = False
if ("S" in S) and not("N" in S):
    ans = False
if ("W" in S) and not("E" in S):
    ans = False
if ("E" in S) and not("W" in S):
    ans = False

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

Solution (Python):


S=input()

if "E" in S or "W" in S:
    if "E" in S and "W" in S:
        pass
    else:
        print("No")
        exit()

if "N" in S or "S" in S:
    if "N" in S and "S" in S:
        pass
    else:
        print("No")
        exit()

print("Yes")

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

if s==set('WE') or s==set('SN') or s==set('SNWE'):
    print('Yes')
else:
    print('No')

Solution (Python):
s = input()

dir = [0 for i in range(4)]
for i in range(len(s)):
    if s[i] == "N":
        dir[0] += 1
    elif s[i] == "W":
        dir[1] += 1
    elif s[i] == "S":
        dir[2] += 1
    elif s[i] == "E":
        dir[3] += 1

if 0 not in dir:
    print("Yes")
elif dir.count(0) == 3:
    print("No")
elif dir[0] == 0 and dir[2] == 0 or dir[1] == 0 and dir[3] == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
s = input()

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

Solution (Python):
s = list(input())
if len(set(s)) == 4:
    print('Yes')
elif len(set(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=set(sorted(list(input())))
if S=={'E','N','S','W'} or S=={'N','S'} or S=={'E','W'}:
    print('Yes')
else:
    print('No')

Solution (Python):
s = input()

flag = [0, 0]

if ("N" in s and "S" in s) or ("N" not in s and "S" not in s):
    flag[0] = 1
if ("W" in s and "E" in s) or ("W" not in s and "E" not in s):
    flag[1] = 1

if sum(flag) == 2:
    print("Yes")
else:
    print("No")

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

Solution (Python):
s = input()

N,W,S,E = s.count("N"),s.count("W"),s.count("S"),s.count("E")

cond = 1

if N == 0 and S > 0:
	cond = 0
if S == 0 and N > 0:
	cond = 0
if W == 0 and E > 0:
	cond = 0
if E == 0 and W > 0:
	cond = 0

if cond:
	print("Yes")
else:
	print("No")

Solution (Python):
S = input().strip()
C = {"N":0,"S":0,"E":0,"W":0}
for i in range(len(S)):
    C[S[i]] += 1
if (C["N"]*C["S"]>0 or (C["N"]==0 and C["S"]==0)) and (C["E"]*C["W"]>0 or (C["E"]==0 and C["W"]==0)):
    print("Yes")
else:
    print("No")

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

Solution (Python):
sl = list(input())
move = len(set(sl))

if move == 4:
    print('Yes')
elif move == 2:
    if ('N' in set(sl) and 'S' in set(sl)) or ('E' in set(sl) and 'W' in set(sl)):
        print('Yes')
    else:
        print('No')
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 defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10


def solve():
    s = S()
    ans = [0, 0]
    for si in s:
        if si == "N":
            ans[0] |= 1
        elif si == "W":
            ans[1] |= 1
        elif si == "S":
            ans[0] |= 2
        else:
            ans[1] |= 2
    if ans[0] in [0, 3] and ans[1] in [0, 3]:
        print("Yes")
    else:
        print("No")
    return



if __name__ == '__main__':
    solve()

Solution (Python):
S=input()
flag=[]
if 'N' in S:
    if 'S' in S:
        flag.append(True)
    else:
        flag.append(False)

if 'S' in S:
    if 'N' in S:
        flag.append(True)
    else:
        flag.append(False)

if 'W' in S:
    if 'E' in S:
        flag.append(True)
    else:
        flag.append(False)

if 'E' in S:
    if 'W' in S:
        flag.append(True)
    else:
        flag.append(False)

if False in flag:
    print('No')
else:
    print('Yes')

Solution (Python):
S=input()

Nflag=False
Wflag=False
Sflag=False
Eflag=False

if "N" in S:
   Nflag=True
if "W" in S:
   Wflag=True
if "S" in S:
   Sflag=True
if "E" in S:
   Eflag=True

if Nflag and Wflag and Sflag and Eflag:
   print("Yes")
elif Nflag and Sflag and Wflag==False and Eflag==False:
   print("Yes")
elif Nflag==False and Sflag==False and Wflag and Eflag:
   print("Yes")
else:
   print("No")

Solution (Python):

S = input()
l = {"E":0, "W":0, "S":0, "N":0}
for i in range(len(S)):
    l[S[i]] += 1
f1, f2 = False, False
if (l["W"] != 0 and l["E"] != 0) or l["W"] == l["E"] == 0:
    f1 = True
if (l["N"] != 0 and l["S"] != 0) or l["N"] == l["S"] == 0:
    f2 = True
print("Yes" if f1 and f2 else "No")

Solution (Python):
s = set(list(str(input())))
if s == {'N', 'S', 'E', 'W'} or s == {'N', 'S'} or s == {'E', 'W'}:
  print('Yes')
else:
  print('No')

Solution (Python):
s = set(list(str(input())))
if s == {'N', 'S', 'E', 'W'} or s == {'N', 'S'} or s == {'E', 'W'}:
  print('Yes')
else:
  print('No')

Solution (Python):


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

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

S = set(read().rstrip().decode('utf-8'))

answer = 'Yes'
for x,y in ['EW','NS','WE','SN']:
    if x in S and y not in S:
        answer = 'No'

print(answer)

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

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

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

Solution (Python):
def main(S):
    d = {x: 0 for x in "NWES"}
    for s in S:
        d[s] += 1
    if d["N"] * d["S"] == 0 and d["N"] + d["S"] != 0:
        return "No"
    if d["E"] * d["W"] == 0 and d["E"] + d["W"] != 0:
        return "No"
    return "Yes"


if __name__ == "__main__":
    S = input()
    ans = main(S)
    print(ans)

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

Solution (Python):

S = input()

directions = [False for _ in range(4)]
for s in S:
    if s == 'S':
        directions[0] = True
    if s == 'N':
        directions[1] = True
    if s == 'W':
        directions[2] = True
    if s == 'E':
        directions[3] = True


if directions[0] ^ directions[1] or directions[2] ^ directions[3]:
    print('No')

else:
    print('Yes')

Solution (Python):
S = input()

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

Solution (Python):
s=input()
l=[x in s for x in list("NEWS")]
if (l[-1]==l[0]) and (l[1]==l[2]):
  print("Yes")
else:print("No")

Solution (Python):

from collections import defaultdict
S = input()
dd = defaultdict(int)
for s in S:
    dd[s]+=1
if ((dd['S']>0)^(dd['N']>0)):
    print ("No")
elif((dd['E']>0)^(dd['W']>0)):
    print ("No")
else:
    print ("Yes")

Solution (Python):
import sys
import os
if sys.platform=="darwin":
	base = os.path.dirname(os.path.abspath(__file__))
	name = os.path.normpath(os.path.join(base, '../Documents/input.txt'))
	
	sys.stdin = open(name)

s = input()
ansns = 0
ansew = 0

ansns = s.count("N") * s.count("S")
if s.count("N")==0 and s.count("S")==0:
	ansns = 1

ansew = s.count("E") * s.count("W")
if s.count("E")==0 and s.count("W")==0:
	ansew = 1

ans = ansns * ansew

print("Yes" if ans!=0 else "No")

Solution (Python):
s=input()

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

for i in s:
	if i=="N":
		N=1
	if i=="S":
		S=1
	if i=="E":
		E=1
	if i=="W":
		W=1
		
if N+S==1 or E+W==1:
	ans="No"
else:
	ans="Yes"
print(ans)

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

Solution (Python):
S = input()
d = {'N': 0, 'S': 0, 'W': 0, 'E': 0}
for s in S:
    d[s] = 1

ans = "Yes"
if (d['N'] ^ d['S']) or (d['W'] ^ d['E']):
    ans = "No"

print(ans)

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

n = a.count('N')
s = a.count('S')
w = a.count('W')
e = a.count('E')

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

Solution (Python):
S = input()
if len(S)==1:
  print('No')
  exit()

cntN = S.count('N')
cntW = S.count('W')
cntS = S.count('S')
cntE = S.count('E')

f1, f2 = False, False
if (cntN == 0 and cntS == 0) or (cntN > 0 and cntS > 0): f1 = True
if (cntW == 0 and cntE == 0) or (cntW > 0 and cntE > 0): f2 = True
print('Yes' if f1 is True and f2 is True else 'No' )

Solution (Python):
from collections import Counter

S = list(set(list(input())))

x = [0, 0]
for s in S:
    if s == "E":
        x[0] += 1
    elif s == "W":
        x[0] -= 1
    elif s == "N":
        x[1] += 1
    elif s == "S":
        x[1] -= 1

print('Yes' if x == [0, 0] else 'No')

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

    print('No')
else:
    print('Yes')

Solution (Python):
def examA():
    S = SI()
    d = defaultdict(bool)
    ans = "Yes"
    for s in S:
        d[s] = True
    if (d["S"] and (not d["N"])) or (d["N"] and (not d["S"])):
        ans = "No"
    if (d["E"] and (not d["W"])) or (d["W"] and (not d["E"])):
        ans = "No"
    print(ans)


import sys,copy,bisect,itertools,heapq,math
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()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examA()

Solution (Python):
s=input()
x=[0,0,0,0]
for i in s:
    if i=="N":
        x[0]=1
    elif i=="S":
        x[1]=1
    elif i=="W":
        x[2]=1
    else:
        x[3]=1

if x==[1,1,1,1] or x==[0,0,1,1] or x==[1,1,0,0]:
    print("Yes")
else:
    print("No")