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 = "No"
if(("N" in S) == ("S" in S) and ("W" in S) == ("E" in S)):
  ans = "Yes"
print(ans)

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

Solution (Python):
s = input()
result = "Yes"
if s.find('N') > -1 :
  if s.find('S') == -1:
    result = "No"
if s.find('S') > -1 :
  if s.find('N') == -1:
    result = "No"
if s.find('W') > -1 :
  if s.find('E') == -1:
    result = "No"
if s.find('E') > -1 :
  if s.find('W') == -1:
    result = "No"
print(result)

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

Solution (Python):
def main():
    s=set(input())
    if(set("NS")==s or set("WE")==s or set("NSEW")==s):
        print("Yes")
    else:
        print("No")
if __name__=="__main__":
    main()

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

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

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

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

print(['Yes', 'No'][flag])

Solution (Python):
s = input()

back_home = True

if 'N' in s:
    if 'S' not in s:
        back_home = False
        
if 'S' in s:
    if 'N' not in s:
        back_home = False
        
if 'E' in s:
    if 'W' not in s:
        back_home = False
        
if 'W' in s:
    if 'E' not in s:
        back_home = False
        
if back_home:
    print("Yes")
else:
    print("No")

Solution (Python):
s = list(sorted(set(str(input()))))
if len(s) == 2:
    if (s[0] == "N" and s[1] == "S") or (s[0] == "E" and s[1] == "W"): 
        print("Yes")
    else:
        print("No")
if len(s) == 1 or len(s) == 3:
    print("No")
if len(s) == 4:
    print("Yes")

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

C = Counter(s)
if all([C['N'], C['S']]) is any([C['N'], C['S']]) and all([C['W'], C['E']]) is any([C['W'], C['E']]):
    print('Yes')
else:
    print('No')

Solution (Python):
s=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:
    print("No" if "W" in s or "E" in s else "Yes")
elif "W" in s and "E" in s:
    print("No" if "N" in s or "S" in s else "Yes")
else:
    print("No")

Solution (Python):
S = input()

tmp = [0 for _ in range(4)]

res = 'Yes'
for i in range(len(S)):
    if S[i] == 'S':
        tmp[0] = 1
    elif S[i] == 'N':
        tmp[1] = 1
    elif S[i] == 'W':
        tmp[2] = 1
    else:
        tmp[3] = 1
        
if tmp[0] == 1 and tmp[1] == 0:
    res = 'No'
if tmp[1] == 1 and tmp[0] == 0:
    res = 'No'
if tmp[2] == 1 and tmp[3] == 0:
    res = 'No'
if tmp[3] == 1 and tmp[2] == 0:
    res = 'No'

print(res)

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

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

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

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

Solution (Python):
s = input()

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

Solution (Python):
string_list=list(input())
N= "N"in string_list
S= "S"in string_list
E= "E"in string_list
W= "W"in string_list
if N^S==0 and E^W==0:
    print("Yes")
else:
    print("No")

Solution (Python):
S = input()
Ns = bool(S.count('N'))
Ss = bool(S.count('S'))
Es = bool(S.count('E'))
Ws = bool(S.count('W'))
if (Ns ^ Ss) or (Es ^ Ws): print('No')
else: print('Yes')

Solution (Python):
s=set(input())
if len(s)%2==0:
  if s==set("SN") or s==set("WE") or s==set("SENW"):
    print("Yes")
  else:
    print("No")
else:
  print("No")

Solution (Python):
s = input()
length = len(s)

x = [s[i] for i in range(length)]

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 "E" in s:
    if "W" not in s:
        print("No")
        exit()
if "W" in s:
    if "E" not in s:
        print("No")
        exit()

print("Yes")

Solution (Python):
import os
import math
import itertools
INF, MOD = float("inf"), 1e9 + 7
MAX, MIN = -INF, INF
dx1, dy1, dx2, dy2 = [-1, 0, 1, 0], [0, -1, 0, 1], [-1, 0, 1, -1, 1, -1, 0, 1], [-1, -1, -1, 0, 0, 1, 1, 1]

def get_int():
    return int(input())

def get_int_list():
    return list(map(int, input().split()))

while(True):
    try:
        s = input()
        if ('N' in s) == ('S' in s) and ('W' in s) == ('E' in s):
            print("Yes")
        else:
            print("No")
    except EOFError:
        exit()

Solution (Python):
k = str(input())


n = 0
w = 0
s = 0
e = 0
for i in range(len(k)):
    if k[i] == "N":
        n += 1
    elif k[i] == "W":
        w += 1
    elif k[i] == "S":
        s += 1
    else:
        e += 1
if (n == 0 and s > 0) or (s == 0 and n > 0) or (e == 0 and w > 0) or (w == 0 and e > 0):
    print("No")
else:
    print("Yes")

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

Solution (Python):
s = input()

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

for i in s:
    if i == "N":
        N += 1
    elif i == "W":
        W += 1
    elif i == "S":
        S += 1
    elif i == "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")

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

Solution (Python):
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**8) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from collections import Counter

s = ns()
cnt = Counter()

for si in s:
    cnt[si] += 1
    
print('No')  if (cnt['N'] > 0 and cnt['S'] == 0) or\
                (cnt['N'] == 0 and cnt['S'] > 0) or\
                (cnt['E'] > 0 and cnt['W'] == 0) or\
                (cnt['E'] == 0 and cnt['W'] > 0) 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):
a = input()
for i in ["SN","EW","ENSW"]:
    if set(i) == set(a):
        print("Yes")
        exit()
print("No")

Solution (Python):
a = input()
for i in ["SN","EW","ENSW"]:
    if set(i) == set(a):
        print("Yes")
        exit()
print("No")

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

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

Solution (Python):
s=set(input());print("YNeos"[1 in[(len(s&set(t)))for t in["NS","WE"]]::2])

Solution (Python):
S = input()

S = set(S)
if 1 not in [len(S&set(t)) for t in ["NS", "WE"]]:
    print("Yes")
else:
    print("No")

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

a = []
b = []
for i in S:
    if i == "N" or i == "S":
        a.append(i)
    else:
        b.append(i)

if len(set(a)) == 1 or len(set(b)) == 1:
    print("No")

else:
    print("Yes")

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

s = input()
ans = "Yes"
if "W" in s:
    if not "E" in s:
        ans = "No"
if "E" in s:
    if not "W" in s:
        ans = "No"

if "N" in s:
    if not "S" in s:
        ans = "No"
if "S" in s:
    if not "N" in s:
        ans = "No"

print(ans)

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

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

Solution (Python):


import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def ceil(a, b=1): return int(-(-a // b))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

S = input()


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

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

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

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

Solution (Python):
S = input()

n = 0
s = 0
e = 0
w = 0

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

if abs(n-s)==1 or abs(e-w)==1:
	print('No')
else:
	print('Yes')

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

Solution (Python):
s = input().strip()
if not ('S' in s and 'N' in s) and ('S' in s or 'N' in s):
        print('No')
        exit()

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

 
print('Yes')

Solution (Python):
S=input()
rec={"N":0,"W":0,"S":0,"E":0}
for i in S:
    rec[i]+=1

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

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

Solution (Python):
from collections import Counter

S = input()

set_S = set(list(S))

if len(set_S) == 2:
    if set_S == set(['N', 'S']):
        print('Yes')
    elif set_S == set(['W', 'E']):
        print('Yes')
    else:
        print('No')
elif len(set_S) == 4:
    print('Yes')
else:
    print('No')

Solution (Python):
ｓ = input()
if (("N" in s and "S" not in s) 
 or ("S" in s and "N" 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()
if ("N" in s and "S" not in s) \
 or ("S" in s and "N" 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()
s = set(S)
if ("N" in s and "S" not in s) \
 or ("S" in s and "N" 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())
N = bool(s.count('N'))
E = bool(s.count('E'))
W = bool(s.count('W'))
S = bool(s.count('S'))

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

Solution (Python):
ar = list(input())
br = set(ar)
if len(br) == 4:
    print("Yes")
elif len(br) == 1 or len(br) == 3:
    print("No")
else:
    if "N" in br and "S" in br:
        print("Yes")
    elif "E" in br and "W" in br:
        print("Yes")
    else:
        print("No")

Solution (Python):
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    S = input_raw[0]
    W_num = S.count("W")
    E_num = S.count("E")
    if (W_num == 0 and E_num != 0) or (E_num == 0 and W_num != 0):
        print "No"
        return

    N_num = S.count("N")
    S_num = S.count("S")
    if (N_num == 0 and S_num != 0) or (S_num == 0 and N_num != 0):
        print "No"
        return

    print "Yes"


if __name__ == '__main__':
    main()

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

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

Solution (Python):



def main():
    """Function."""
    s = str(input())

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

    ns_flag = -1
    if N == 0 and S == 0:
        ns_flag = 1
    elif N == 0 and S != 0:
        ns_flag = -1
    elif N != 0 and S == 0:
        ns_flag = -1
    else:
        ns_flag = 1

    we_flag = -1
    if W == 0 and E == 0:
        we_flag = 1
    elif W == 0 and E != 0:
        we_flag = -1
    elif W != 0 and E == 0:
        we_flag = -1
    else:
        we_flag = 1

    if ns_flag == -1 or we_flag == -1:
        print("No")
    else:
        print("Yes")


if __name__ == "__main__":
    main()

Solution (Python):

S = set(input())
if S==set("NSEW") or S==set("NS") or S==set("EW"):
    print("Yes")
else:
    print("No")

Solution (Python):

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

Solution (Python):
S = input()
s = set(S)
if ("N" in s and "S" not in s) \
 or ("S" in s and "N" 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):
aa = input()
s =0;w = 0;e=0;n=0;
if "S" in aa:
  s = 1
if "N" in aa:
  n = 1
if "E" in aa:
  e = 1
if "W" in aa:
  w = 1
if (s and w and n and e) or (s and n and e == 0 and w == 0) or(s==0 and n==0 and e and w):
  print("Yes")
else:
  print("No")

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

Solution (Python):
s = input()
news = [0, 0, 0, 0]
for i in range(len(s)):
    if s[i] == "N":
        news[0] += 1
    elif s[i] == "E":
        news[1] += 1
    elif s[i] == "W":
        news[2] += 1
    elif s[i] == "S":
        news[3] += 1
if news[0] > 0 and news[3] == 0:
    print("No")
    exit()
if news[0] == 0 and news[3] > 0:
    print("No")
    exit()
if news[1] > 0 and news[2] == 0:
    print("No")
    exit()
if news[1] == 0 and news[2] > 0:
    print("No")
    exit()
print("Yes")

Solution (Python):



def main():
    s = input()
    n_count = s.count('N')
    s_count = s.count('S')
    e_count = s.count('E')
    w_count = s.count('W')

    if n_count > 0 and s_count == 0:
        print('No')
    elif s_count > 0 and n_count == 0:
        print('No')
    elif e_count > 0 and w_count == 0:
        print('No')
    elif w_count > 0 and e_count == 0:
        print('No')
    else:
        print('Yes')


if __name__ == '__main__':
    main()

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

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

Solution (Python):
ins = input().strip()
if not ('S' in ins and 'N' in ins) and ('S' in ins or 'N' in ins):
        print('No')
        exit()
if not ('E' in ins and 'W' in ins) and ('E' in ins or 'W' in ins):
        print('No')
        exit()

print('Yes')

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

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

Solution (Python):
from collections import defaultdict as dd

s = input().strip()
coll = dd(int)

for el in s:
    coll[el] += 1


condition = (
    min(coll["N"], coll["S"]) == 0 and
    max(coll["N"], coll["S"]) != 0 or
    min(coll["E"], coll["W"]) == 0 and
    max(coll["E"], coll["W"]) != 0)

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

Solution (Python):
s=list(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('W')>0 and s.count('E')>0 and s.count('N')==0 and s.count('S')==0:
    print('Yes')
elif s.count('W')==0 and s.count('E')==0 and s.count('N')>0 and s.count('S')>0:
    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
print("Yes" if n == s and e == w else "No")

Solution (Python):
S = input()
rec = {"N": 0, "W": 0, "S": 0, "E": 0}
for i in S:
    rec[i] += 1

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

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

Solution (Python):
S = input()

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

home = False
if n and s:
    if e and w:
        print("Yes")
    elif not e and not w:
        print("Yes")
    else:
        print("No")

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

else:
    print("No")

Solution (Python):
from sys import stdin


def main() -> None:
    s = next_str()
    x = set()
    y = set()

    for c in s:
        if c == "N" or c == "S":
            y.add(c)
        if c == "W" or c == "E":
            x.add(c)

    if len(x) % 2 != 0 or len(y) % 2 != 0:
        print("No")
    else:
        print("Yes")


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


if __name__ == '__main__':
    main()

Solution (Python):
S = list({i for i in input()})

if len(S)==1 or len(S)==3:
    print("No")
    exit()

elif len(S)==4:
    print("Yes")
    exit()

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

Solution (Python):
x = input()
n = x.count("N")
w = x.count("W")
s = x.count("S")
e = x.count("E")
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")

Solution (Python):
news = str(input())
news = list(news)
cn = news.count('N')
ce = news.count('E')
cw = news.count('W')
cs = news.count('S')
if cn > 0 and ce > 0 and cw > 0 and cs > 0 :
  print("Yes")
elif cn == cs == 0:
  if cw > 0 and ce > 0:
    print("Yes")
  else:
    print("No")
elif cw == ce == 0:
  if cn > 0 and cs > 0:
    print("Yes")
  else:
    print("No")
else:
  print("No")

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

Solution (Python):
s = input()
a = -1
b = -1
c = -1
d = -1

for i in range(len(s)):
    if s[i] == "W":
        a = 1
    elif s[i] == "E":
        b = 1
    elif s[i] == "S":
        c = 1
    else:
        d = 1

if a * b == 1 and c * d == 1:
    print("Yes")
else:
    print("No")

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



n = 0
s = 0
w = 0
e = 0

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


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

else:
    print("No")

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

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

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

else:
    print("No")

Solution (Python):
S = input()

Count = {"N":0, "W":0, "S":0, "E":0}

for ch in S:
  Count[ch] += 1
  
if max(Count["N"], Count["S"]) > 0 and min(Count["N"], Count["S"]) == 0:
  print("No")
elif max(Count["E"], Count["W"]) > 0 and min(Count["E"], Count["W"]) == 0:
  print("No")
else:
  print("Yes")

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

v = [i in s for i in ['S', 'N']]
h = [i in s for i in ['E', 'W']]
if sum(v) == 1 or sum(h) == 1:
    print("No")
else:
    print("Yes")

Solution (Python):
string = input()

w = 0
e = 0
s = 0
n = 0

for i in range(len(string)):
    if string[i] == 'W':
        w = 1
    elif string[i] == 'E':
        e = 1
    elif string[i] == 'S':
        s = 1
    else:
        n = 1
        
if w == e and s == n:
    print('Yes')
else:
    print('No')

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

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

Solution (Python):
hoge = str(input())
list_hoge = list(hoge)
n = list_hoge.count("N")
s = list_hoge.count("S")
e = list_hoge.count("E")
w = list_hoge.count("W")
ans = "Yes"
if n+s != 0:
    if n == 0 or s == 0:
        ans ="No"
    else:
         pass
else:
    pass

if e+w != 0:
    if e == 0 or w == 0:
        ans = "No"
    else:
        pass
else:
    pass

print(ans)

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

ch = 0
if dic['S'] > 0:
    if dic['N'] == 0:
        ch = 1

if dic['N'] > 0:
    if dic['S'] == 0:
        ch = 1

if dic['E'] > 0:
    if dic['W'] == 0:
        ch = 1

if dic['W'] > 0:
    if dic['E'] == 0:
        ch = 1


if ch == 0:
    print('Yes')
else:
    print('No')

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

if s["N"]>=1 and s["S"]>=1 and s["W"]>=1 and s["E"]>=1:
    print('Yes')
    exit()
elif s["N"]>=1 and s["S"]>=1 and s["W"]==0 and s["E"]==0:
    print('Yes')
    exit()
elif s["N"]==0 and s["S"]==0 and s["W"]>=1 and s["E"]>=1:
    print('Yes')
    exit()
print('No')

Solution (Python):
S = input()
T = set(S)
if (len(T) == 4):
  print('Yes')
elif (len(T) == 1 or len(T) == 3):
  print('No')
else:
  if ('N' in T):
    if ('S' in T):
      print('Yes')
    else:
      print('No')
  elif ('S' in T):
    if ('N' in T):
      print('Yes')
    else:
      print('No')
  elif ('W' in T):
    if ('E' in T):
      print('Yes')
    else:
      print('No')
  else:
    if ('W' in T):
      print('Yes')
    else:
      print('No')

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

Solution (Python):
s = set(input())
ans = 0
if len(s) == 4:
    ans = 1
elif len(s) == 2:
    if set("NS") == s or set("EW") == s:
        ans = 1
print("Yes" if ans else "No")

Solution (Python):


INF = float('inf')


def inpl(): return list(map(int, input().split()))


S = input()
S_li = list(S)
direction = ('N', 'W', 'S', 'E')
judge = []
for di in direction:
    if di in S_li:
        judge.append(1)
    else:
        judge.append(0)


if judge[0] ^ judge[2] == 1:
    print('No')
elif judge[1] ^ judge[3] == 1:
    print('No')
else:
    print('Yes')

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

Solution (Python):
s = input()
print(['No','Yes'][('W'in s)==('E'in s)and('N'in s)==('S'in s)])

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

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

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

def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(ns())
def nf(): return float(ns())

s = lc()

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

Solution (Python):
s = input()
l = [0]*4
y = "Yes"
n = "No"
res = ""

for i in s:
    if i == "S":
        l[0] += 1
    elif i == "E":
        l[1] += 1
    elif i == "N":
        l[2] += 1
    elif i == "W":
        l[3] += 1

if (l[0] == 0 and l[2] >= 1) or (l[0] >= 1 and l[2] == 0) or (l[1] == 0 and l[3] >= 1) or (l[3] == 0 and l[1] >= 1):
    res = n
else:
    res = y

print(res)

Solution (Python):
S = input()
if len(set(S)) % 2 == 1:
    print('No')
elif 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')

Solution (Python):
def main23():
    strbuf = input("");
    flag = [];
    for i in range(4):
        flag.append(False);
    for i in range(len(strbuf)):
        if strbuf[i] == 'N':
            flag[0] = True;
        if strbuf[i] == 'W':
            flag[1] = True;
        if strbuf[i] == 'S':
            flag[2] = True;
        if strbuf[i] == 'E':
            flag[3] = True;
    if (flag[0] and not(flag[2])) or (flag[2] and not(flag[0])):
        print("No");
    elif (flag[1] and not(flag[3])) or (flag[3] and not(flag[1])):
        print("No");
    else:
        print("Yes");

if __name__ == '__main__':
    main23()

Solution (Python):

s=list(input())
a = s.count('N')
b = s.count('W')
c = s.count('S')
d = s.count('E')
ass = 0
if a ==0:
    if c == 0:
        ass += 1
else:
    if c > 0:
        ass += 1
if b == 0:
    if d == 0:
        ass += 1
else:
    if d > 0:
        ass += 1

if ass == 2:
    print('Yes')
else:
    print('No')

Solution (Python):
x,y=0,0
s=input()

a=s.count("N")>0
b=s.count("S")>0
c=s.count("E")>0
d=s.count("W")>0
e=(a,b,c,d)
if e==(True,True,False,False) or e==(False,False,True,True) or e==(True,True,True,True):
  print("Yes")
else:
  print("No")

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

Solution (Python):
s = set(raw_input())
l = len(s)
if l in [1, 3]:
    print 'No'
elif l == 4:
    print 'Yes'
else:
    print ['No', 'Yes'][s in [set('NS'), set('WE')]]

Solution (Python):
s = set(raw_input())
l = len(s)
if l in [1, 3]:
    print 'No'
elif l == 4:
    print 'Yes'
else:
    print ['No', 'Yes'][s in [set('NS'), set('WE')]]