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



Sample input:
SENW


Sample output:
Yes

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = input()

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
A - Wanna go back home
https://atcoder.jp/contests/agc003/tasks/agc003_a

"""
import sys


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


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


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
n,w,s,e = 0,0,0,0
for i in S:
    if i == "N":
        n = 1
    if i == "W":
        w = 1
    if i == "S":
        s = 1
    if i == "E":
        e = 1
#print(n,s,w,e)
if n == s and w == e:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = input()

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

Submission status: Accepted

Solution code:
s = input()

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

#A
def A():
    s = S()
    a = s.count("a")
    b = s.count("b")
    c = 3-a-b
    if a&b&c:
        print("Yes")
    else:
        print("No")
#B
def B():
    a,b,k = LI()
    ans = []
    for i in range(a,min(a+k,b+1)):
        ans.append(i)
    for i in range(max(a,b-k+1),b+1):
        ans.append(i)
    ans = list(set(ans))
    ans.sort()
    for i in ans:
        print(i)

#C
def C():
    a,b,c = LI()
    ans = 0
    if a%2:
        if b%2:
            if not c%2:
                ans += 1
                a += 1
                b += 1
        else:
            ans += 1
            if not c%2:
                b += 1
                c += 1
            else:
                a += 1
                c += 1
    else:
        if b%2:
            ans += 1
            if not c%2:
                a += 1
                c += 1
            else:
                b += 1
                c += 1
        else:
            if c%2:
                ans += 1
                a += 1
                b += 1
    ans += (3*max(a,b,c)-a-b-c)//2
    print(ans)
#D
def D():
    q = I()
    for i in range(q):
        a,b = LI()
        x = int((a*b)**0.5)
        y = math.ceil((a*b)/x)-1
        ans = x+y-2
        if a==b:
            ans += 1
        print(ans)

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

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    E()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

S = str(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = input()

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=list(input())

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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')