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: Wrong Answer

Solution code:
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: f1 = True
elif cntN > 0 and cntS > 0 and (cntN-cntS)%2==0: f1 = True

if cntW == 0 and cntE == 0: f2 = True
elif cntW > 0 and cntE > 0 and (cntW-cntE)%2==0: f2 = True
print('Yes' if f1 is True and f2 is True else 'No' )

Submission status: Wrong Answer

Solution code:
S = input()
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: f1 = True
elif cntN > 0 and cntS > 0 and (cntN-cntS)%2==0: f1 = True

if cntW == 0 and cntE == 0: f2 = True
elif cntW > 0 and cntE > 0 and (cntW-cntE)%2==0: f2 = True
print('Yes' if f1 is True and f2 is True else 'No' )

Submission status: Wrong Answer

Solution code:
from sys import stdin

s = stdin.readline().rstrip()

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

Submission status: Wrong Answer

Solution code:
from sys import stdin

s = stdin.readline().rstrip()

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

Submission status: Wrong Answer

Solution code:
s = input()
if len(set(s))%2 == 0 and (s.count("N") and s.count("S")) != 0 and (s.count("W") and s.count("E")) != 0:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
s = input()
if len(set(s))%2 == 0:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = set(input())

t = 0
for _s in s:
    if _s in "NE":
        t += 1
    if _s in "SW":
        t -= 1

print("Yes" if t == 0 else "No")

Submission status: Wrong Answer

Solution code:
S = list(set(list(input())))
c = 0
for i in S:
    if i == "N":
        c += 1
    elif i == "W":
        c += 1
    elif i == "S":
        c -= 1
    else:
        c -= 1
if c == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def main(s):
    _s = set(s)

    if len(_s) % 2 != 0:
        print('No')
        return

    if ('N' and 'W' and 'S' and 'E') in _s:
        print('Yes')
    elif len(_s) % 2 == 0 and (('N' and 'S') or ('W' and 'E')) in _s:
        print('Yes')
    
    print('No')

if __name__ == '__main__':
    s = input()

    main(s)

Submission status: Wrong Answer

Solution code:
def main(s):
    _s = set(s)

    if len(_s) % 2 != 0:
        print('No')
        return

    if ('N' and 'W' and 'S' and 'E') in _s:
        print('Yes')
    elif len(_s) % 2 == 0 and (('N' and 'S') or ('W' and 'E')) in _s:
        print('Yes')


if __name__ == '__main__':
    s = input()

    main(s)

Submission status: Wrong Answer

Solution code:
def main(s):
    _s = set(s)

    if len(_s) % 2 != 0:
        print('No')
        return

    if ('N' and 'W' and 'S' and 'E') in _s:
        print('Yes')
    elif (('N' and 'S') or ('W' and 'E')) in _s:
        print('Yes')


if __name__ == '__main__':
    s = input()

    main(s)

Submission status: Wrong Answer

Solution code:
def main(s):
    _s = set(s)

    if len(_s) % 2 != 0:
        print('No')
        return

    if ('N' and 'S') in _s:
        print('Yes')
    elif ('W' and 'E') in _s:
        print('Yes')


if __name__ == '__main__':
    s = input()

    main(s)

Submission status: Wrong Answer

Solution code:
# AGC 003: A – Wanna go back home
s = input()
print('Yes' if ('N' in s and 'S' in s) or ('E' in s and 'W' in s) else 'No')

Submission status: Wrong Answer

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

s = input()
n = len(s)
u = 0
l = 0
for i in s:
    if i == 'N':
        u += 1
    elif i == 'S':
        u -= 1
    elif i == 'E':
        l += 1
    else:
        l -= 1
    if u == 0 and l == 0:
        print('Yes')
        break
else:
    print('No')

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

S = input()
d = defaultdict(int)
for i in S:
    d[i] += 1

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

S = input()
d = defaultdict(int)
for i in S:
    d[i] += 1

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

S = input()
d = defaultdict(int)
for i in S:
    d[i] += 1

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

Submission status: Wrong Answer

Solution code:
S=input()


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

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

if "N" in S:
    if not "S" in S:
        print("No")

if "S" in S:
    if not "N" in S:
        print("No")
print("Yes")

Submission status: Wrong Answer

Solution code:
S=input()

f=True
if "W" in S:
    if not "E" in S:
        f=False
    else:
        f=True

if "E" in S:
    if not "W" in S:
        f=False
    else:
        f=True

if "N" in S:
    if not "S" in S:
        f=False
    else:
        f=True

if "S" in S:
    if not "N" in S:
        f=False
    else:
        f=True

if f==True:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S=input()

f=False
if "W" in S:
    if "E" in S:
        f=True
    else:
        f=False

if "E" in S:
    if "W" in S:
        f=True
    else:
        f=False

if "N" in S:
    if "S" in S:
        f=True
    else:
        f=False

if "S" in S:
    if "N" in S:
        f=True
    else:
        f=False

if f==True:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S=input()

f=False
if "W" in S:
    if "E" in S:
        f=True

if "E" in S:
    if "W" in S:
        f=True
    else:
        f=False

if "N" in S:
    if "S" in S:
        f=True
    else:
        f=False

if "S" in S:
    if "N" in S:
        f=True
    else:
        f=False

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

Submission status: Wrong Answer

Solution code:
S = input()
w = "w"
n = "n"
e = "e"
s = "s"

if w and e or n and s:
    print('Not')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
S = input()
ans = True

if S.count("S") >= 1:
    if S.count("N") == 0:
        ans = False

elif S.count("N") >= 1:
    if S.count("S") == 0:
        ans = False

elif S.count("W") >= 1:
    if S.count("E") == 0:
        ans = False

elif S.count("E") >= 1:
    if S.count("W") == 0:
        ans = False

if ans:
    print("Yes")

else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = input()
x = True
y = True

if S.count("S") >= 1:
    if S.count("N") == 0:
        y = False

elif S.count("N") >= 1:
    if S.count("S") == 0:
        y = False

elif S.count("W") >= 1:
    if S.count("E") == 0:
        x = False

elif S.count("E") >= 1:
    if S.count("W") == 0:
        x = False

if x and y:
    print("Yes")

else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
print("Yes" if set(list(input())) in [['S', 'N'],['W', 'E'],['S', 'N', 'W', 'E']] else "No")

Submission status: Wrong Answer

Solution code:
s=set(list(input()))
print("Yes" if len(s)%2==0 and s in [[],["N","S"],["E","W"],["N","S","E","W"]] else "No")

Submission status: Wrong Answer

Solution code:
print("No" if len(set(list(input())))%2 else "Yes")

Submission status: Wrong Answer

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


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
def solve(s):
    s = set(s)
    if ("N" in s) and (not "S" in s):
        return "No"
    if ("W" in s) and (not "E" in s):
        return "No"
    return "Yes"

s = input()
print(solve(s))

Submission status: Wrong Answer

Solution code:
S = input()
if ('N' in S) ^ ('S' in S) or ('W' in S) ^ ('E' in S):
  print('NO')
else:
  print('YES')

Submission status: Wrong Answer

Solution code:
s = input()

if s.count("N") > 0:
  if not s.count("S") > 0:
    print("No")
    exit()
if s.count("W") > 0:
  if not s.count("E") > 0:
    print("No")
    exit()

print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()

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

if (N == 0 ^ S == 0) and (E == 0 ^ W == 0):
  print('No')
else:
  print('Yes')

Submission status: Wrong Answer

Solution code:
s = input()

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

if abs(N-S) <= 1 and abs(E-W) <= 1:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
s = input()

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

if N == S and E == W:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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

if len(S) == 4:
    print ('Yes')
    exit()

if 'N' in S and 'S' in S and len(S) == 2:
    print ('Yes')
    exit()

if 'E' in S and 'W' in 'S' and len(S) == 2:
    print ('Yes')
    exit()

print ('No')

Submission status: Wrong Answer

Solution code:
s=input()
x=0
y=0
for i in s:
    if i=="N":y=max(0,y+1)
    elif i=="S":y=min(0,y-1)
    elif i=="E":x=max(0,x+1)
    else:x=min(0,x-1)
if x==0 and y==0:print("Yes")
else:print("No")

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
S = set(input())
ls = ['N','W','S','E']
for i,x in enumerate(ls[:2]):
    if x in S:
        if ls[i+2] in S:
            continue
        else:
            print('No')
            sys.exit()
print('Yes')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S=input()
print("NYoe s"[all([k in S for k in "NEWS"])::2])

Submission status: Wrong Answer

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 (N == 1 and S == 1)):
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
a = list(input())
x = 0
y = 0
for i in a:
  if i == 'N':
    y += 1
  if i == 'W':
    x -= 1
  if i == 'S':
    y -= 1
  if i == 'E':
    x += 1
if y == x == 0:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
S = input()

x1 = 0
x2 = 0
y1 = 0
y2 = 0

for s in S:
    if s == 'E':
        x1 = 1
    elif s == 'W':
        x2 = 1
    elif s == 'N':
        y1 = 1
    elif s == 'S':
        y2 = 1
        
    if x1 and x2:
        x1 = 0
        x2 = 0
    if y1 and y2:
        y1 = 0
        y2 = 0

if x1 == x2 and y1 == y2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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:
    print('Yes')

Submission status: Wrong Answer

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: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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 (n and not s):
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

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[1]!=0 and ans[2]!=0 and ans[3]!=0:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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]+ans[2])%2==0 and (ans[1]+ans[3])%2==0:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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(3):
        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: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a=input()
s=set()
for i in range(len(a)):
  s.add(a[i])
if len(s)%2==0:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
S = [i for i in input()]
s = set(S)
if 'N' in s and 'S' in s:
    print('Yes')
elif 'W' in s and 'E' in s:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
S = [i for i in input()]
s = set(S)
if 'N' and 'S' in s:
    print('Yes')
elif 'W' and 'E' in s:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
S = [i for i in input()]
s = set(S)
print('Yes' if 'N' and 'S' in s else 'Yes' if 'W' and 'E' in s else 'No')

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
S = input()
i = 0
X = [False,False]
Y = [False,False]
flg = False
while(i < len(S)):
    if S[i:i+1] == 'N':
        X[0] = True
    elif S[i:i+1] == 'S':
        X[1] = True
    elif S[i:i+1] == 'W':
        Y[0] = True
    elif S[i:i+1] == 'E':
        Y[1] = True
    if X[0]==X[1] and Y[0]==Y[1]:
        flg = True
        break
    i+=1
print('Yes' if flg else 'No')

Submission status: Wrong Answer

Solution code:
S = input()
i = 0
X = [False,False]
Y = [False,False]
flg = False
while(i < len(S)):
    if S[i:i+1] == 'N':
        X[0] = True
    elif S[i:i+1] == 'S':
        X[1] = True
    elif S[i:i+1] == 'W':
        Y[0] = True
    elif S[i:i+1] == 'E':
        Y[1] = True
    print(X,Y)
    if X[0]==X[1] and Y[0]==Y[1]:
        flg = True
        break
    i+=1
print('Yes' if flg else 'No')

Submission status: Wrong Answer

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:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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: Wrong Answer

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('S')== 0:
  print('NO')
else:
  print('YES')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = list(input())
W = set(S)
if len(W)%2 == 0:
        print("Yes")
else:
        print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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[2] = 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: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
string_list=list(input())
N = string_list.count("N")
S = string_list.count("S")
E = string_list.count("E")
W = string_list.count("W")
if N-S==0 and E-W ==0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s=list(input())
if len(s)==1 and s[0]=='W':
  exit()
sets=list(set(s))
sets.sort()
l=sets
x=''.join(l)
if x=='ENSW' or x=='EW' or x=='NS':
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
print("YNeos"[len(set(input()))%2!=0::2])

Submission status: Wrong Answer

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("No")

Submission status: Wrong Answer

Solution code:
s = str(input())
x = 0
y = 0
for i in range(len(s)):
    if s[i] == "N":
        y += 1
    elif s[i] == "W":
        x -= 1
    elif s[i] == "S":
        y -= 1
    else:
        x += 1
if (s.count("N")+s.count("S") )% 2 == 0 and (s.count("W")+s.count("E") )% 2 == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s = str(input())
x = 0
y = 0
for i in range(len(s)):
    if s[i] == "N":
        y += 1
    elif s[i] == "W":
        x -= 1
    elif s[i] == "S":
        y -= 1
    else:
        x += 1
if x == 0 and y == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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'

print(ans)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

if 'W' in s and 'E' in s:
  ans = 'Yes'
  if 'N' in s and 'S' in s:
   ans = 'Yes'
  else: ans = 'No'
else: ans = 'No'

print(ans)

Submission status: Wrong Answer

Solution code:
a = input()
W = a.count("W")
S = a.count("S")
E = a.count("E")
N = a.count("N")
print("Yes" if N-S == 0 and W-E == 0 else "No")

Submission status: Wrong Answer

Solution code:
a = input()
W = a.count("W")
S = a.count("S")
E = a.count("E")
N = a.count("N")
print("YES" if N-S == 0 and W-E == 0 else "No")

Submission status: Wrong Answer

Solution code:
S = input()

if 1 not in [len(set(S)&{"N", "S"}), len(set(S)&{"N", "S"})]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
ins = input().strip()
if not ('S' in ins and 'N' in ins) and ('S' in ins or 'N' in ins):
        print('No')

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

 
print('Yes')

Submission status: Wrong Answer

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

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

 
print('Yes')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
a=s.count('S')
b=s.count('E')
c=s.count('N')
d=s.count('W')
ans='Yes'
if a>0:
  if c==0:
    ans='No'
elif c>0:
  if a==0:
    ans='No'
elif b>0:
  if d==0:
    ans='No'
elif d>0:
  if b==0:
    ans='No'
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
tate = S.count('N')-S.count('S')
yoko = S.count('E')- S.count('W')
if tate == yoko == 0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = list(input());print("YNeos"[len(set(s))%2==1::2])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin


def main() -> None:
    s = next_str()
    x = 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()

Submission status: Wrong Answer

Solution code:
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")
    exit()
    
if n % 2 == s % 2 and w % 2 == e % 2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
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 == 0 and cs == 0) or (ce == 0 and cw == 0):
  print("Yes")
else:
  print("No")