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

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

Submission status: Wrong Answer

Solution code:
s = input()
a = 0
b = 0

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

if a == 0 and b == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding:utf-8

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)

print(judge)

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

Submission status: Wrong Answer

Solution code:
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):
    print("No")
elif ("W" in s) and (not "E" in s):
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
a = list(input())

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

for i in range(len(a)):
    if a[i] == "W":
        w += 1
    elif a[i] == "E":
        e += 1
    elif a[i] == "N":
        n += 1
    else:
        s += 1
if (w*e != 0 and n*s != 0):
    print("Yes")
elif ((w+e)*(n+s) != 0):
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
a = list(input())

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

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

Submission status: Wrong Answer

Solution code:
a = list(input())

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

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

Submission status: Wrong Answer

Solution code:
a = list(input())

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

for i in range(len(a)):
    if a[i] == "W":
        w += 1
    elif a[i] == "E":
        e += 1
    elif a[i] == "N":
        n += 1
    else:
        s += 1
if w*e != 0 and n*s != 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
a = list(input())

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

for i in range(len(a)):
    if a[i] == "W":
        w += 1
    elif a[i] == "E":
        e += 1
    elif a[i] == "N":
        n += 1
    else:
        s += 1
if w*s*n*e != 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
a = list(input())

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

for i in range(len(a)):
    if a[i] == "W":
        w += 1
    elif a[i] == "E":
        e += 1
    elif a[i] == "N":
        n += 1
    else:
        s += 1
if w*s*n*e == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
a = list(input())

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

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

Submission status: Wrong Answer

Solution code:
s = raw_input()
a, b, c, d = s.count('S') > 0, s.count('N') > 0, s.count('W') > 0, s.count('E') > 0
print ['NO', 'Yes'][a == b and c == d]

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def back_home():
    S=input()
    if((('S'in S) and ('N' in S)) and not (('E' in S) or  ('W' in S))):
        print('YES')
    elif(not (('S' in S) or ('N'  in S)) and (('E' in S) and ('W' in S))):
        print("YES")
    elif((('S'in S) and ('N' in S)) and (('E' in S) and ('W' in S))):
        print("yes")
    else:
        print("NO")
          
back_home()

Submission status: Wrong Answer

Solution code:
def back_home():
    S=input()
    if((('S'in S) and ('N' in S)) and (('E'not in S) and ('W'not in S))):
        print('YES')
    elif((('S'not in S) and ('N' not in S)) and (('E' in S) and ('W' in S))):
        print("YES")
    elif((('S'in S) and ('N' in S)) and (('E' in S) and ('W' in S))):
        print("yes")
    else:
        print("NO")
          
back_home()

Submission status: Wrong Answer

Solution code:
def back_home():
    S=input()
    if('S'in S and 'N' in S and 'E'not in S and 'W'not in S):
        print('YES')
    elif('S'not in S and 'N' not in S and 'E' in S and 'W' in S):
        print("YES")
    elif('S'in S and 'N' in S and 'E' in S and 'W' in S):
        print("YES")
    else:
        print("NO")
          
back_home()

Submission status: Wrong Answer

Solution code:
def back_home():
    S=input()
    if('S'in S and 'N' in S and 'E'not in S and 'W'not in S):
        print('YES')
    elif('S'not in S and 'N' not in S and 'E' in S and 'W' in S):
        print("YES")
    elif('S'in S and 'N' in S and 'E' in S and 'W' in S):
        print("yes")
    else:
        print("NO")
          
back_home()

Submission status: Wrong Answer

Solution code:
def back_home(r):
    l = dict()
    for i in r:
        if i in l:
            l[i]=int(l[i])+1
        else:
            l[i]=1
    if (len(l)==1):
        return('NO')
    elif(len(l)==2):
        if (len(l['S'])>0 and len(l['N']>0)):
            return ("yes")
        elif(len(l['E'])>0 and len(l['W']>0)):
            return("yes")
        else:
            return("NO")
    elif(len(l)==3):
        return("NO")
    else:
        return("YES")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def backhome():
	s = input()
	if (('N' in s) and ('S' in s)) and not (('W' in s) or ('E' in s)):
		return "Yes"
	elif (('W' in s) and ('E' in s)) and not (('N' in s) or ('S' in s)):
		return "Yes"
	elif (('W' in s) and ('E' in s)) and (('N' in s) and ('S' in s)):
		return "Yes"
	else:
		return "No"

Submission status: Wrong Answer

Solution code:
def backhome(s):
	if (('N' in s) and ('S' in s)) and not (('W' in s) or ('E' in s)):
		return "Yes"
	elif (('W' in s) and ('E' in s)) and not (('N' in s) or ('S' in s)):
		return "Yes"
	elif (('W' in s) and ('E' in s)) and (('N' in s) and ('S' in s)):
		return "Yes"
	else:
		return "No"

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = ''.join(set(input())).replace('W','E').replace('N','S')
print('Yes' if len(s)%2==0 else 'No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = str(input())
if ("W" in s) == ("E" in s):
  if ("N" in s) == ("S" in s):
    print("YES")
    exit()
print("NO")

Submission status: Wrong Answer

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

# AtCoder Grand Contest
# Problem A


if __name__ == '__main__':
    from collections import Counter

    s = Counter(input())
    key_count = len(s.keys())

    if key_count == 4:
        print('Yes')
    elif (key_count == 2):
        if ('S' and 'N') in s.keys() or ('E' and 'W') in s.keys():
            print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# 文字列の読み込み
str = input()
a = list(set(str))
if len(a)==4:
    print("YES")
elif len(a)%2==1:
    print("NO")
else:
    if ('N' in a and 'S' in a ) or ('W' in a and 'E' in a ):
        print("YES")
    else:
        print("NO")

Submission status: Wrong Answer

Solution code:
s = raw_input()
print ['no', 'yes'][('N' in s) == ('S' in s) and ('W' in s) == ('E' in s)]

Submission status: Wrong Answer

Solution code:
str=input()
N,S,W,E=str.__contains__('N'),str.__contains__('S'),str.__contains__('W'),str.__contains__('E')
print("Yes" if (not N and (not S)) or (N and S) and (not W and (not E)) or (W and E) else "No")

Submission status: Wrong Answer

Solution code:
str=input()
N,S,W,E=str.__contains__('N'),str.__contains__('S'),str.__contains__('W'),str.__contains__('E')
print("Yes" if not N and (not S) and (N and S) and (not W and (not E)) and (W and E) else "No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
str=input()
judge=True
if not str.find('N'):
    if  not str.__contains__('S'):
        judge=False
if not str.find('W'):
    if not str.__contains__('E'):
        judge=False
print("Yes" if judge else "No")

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

Submission status: Wrong Answer

Solution code:
from collections import Counter

s = Counter(input())
if s['N'] % 2 == s['S'] % 2 and s["W"] % 2 == s['E'] % 2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
from collections import Counter

s = Counter(input())
if s['N'] == s['S'] and s["W"] == s['E']:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys

s = input()

if s.find('N') != -1:
    if s.find('S') == -1:
        print('NO')
        sys.exit()

if s.find('S') != -1:
    if s.find('N') == -1:
        print('NO')
        sys.exit()

if s.find('W') != -1:
    if s.find('E') == -1:
        print('NO')
        sys.exit()

if s.find('E') != -1:
    if s.find('W') == -1:
        print('NO')
        sys.exit()
        
print('YES')

Submission status: Wrong Answer

Solution code:
s=raw_input()
n=False
e=False
w=False
ss=False
for i in xrange(len(s)):
    if s[i]=="N":n=True
    elif s[i]=="E":e=True
    elif s[i]=="W":w=True
    else:ss=True
if (n and ss) or (e and w):
    print("Yes")
else:
    if not n and not ss and not e and not w:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
s=raw_input()
n=False
e=False
w=False
ss=False
for i in xrange(n):
    if s[i]=="N":n=True
    elif s[i]=="E":e=True
    elif s[i]=="W":w=True
    else:ss=True
if (n and ss) or (e and w):
    print("YES")
else:
    if not n and not ss and not e and not w:
        print("YES")
    else:
        print("NO")

Submission status: Wrong Answer

Solution code:
def solve():
    n, e = 0, 0
    for c in input():
        if c == "N":
            n += 1
        if c == "S":
            n -= 1
        if c == "E":
            e += 1
        if c == "W":
            e -= 1
        if n == 0 and e == 0:
            print("Yes")
            break
    else:
        if n == 0 and e == 0:
            print("Yes")
        else:
            print("No")

if __name__=="__main__":
    solve()

Submission status: Wrong Answer

Solution code:
def solve():
    n, e = 0, 0
    for c in input():
        if c == "N":
            n += 1
        if c == "S":
            n -= 1
        if c == "E":
            e += 1
        if c == "W":
            e -= 1
        if n == 0 and e == 0:
            print("Yes")
            break
    else:
        print("No")

if __name__=="__main__":
    solve()

Submission status: Wrong Answer

Solution code:
def solve():
    n, e = 0, 0
    for c in input():
        if c == "N":
            n += 1
        if c == "S":
            n -= 1
        if c == "E":
            e += 1
        if c == "W":
            e -= 1

    if n == 0 and e == 0:
        print("Yes")
    else:
        print("No")

if __name__=="__main__":
    solve()

Submission status: Wrong Answer

Solution code:
def solve():
    n, e = 0, 0
    for c in input():
        if c == "N":
            n += 1
        if c == "S":
            n -= 1
        if c == "E":
            e += 1
        if c == "W":
            e -= 1
        if n == 0 and e == 0:
            print("Yes")
    else:
        print("No")

if __name__=="__main__":
    solve()

Submission status: Wrong Answer

Solution code:
def solve():
    n, e = 0, 0
    for c in input():
        if c == "N":
            n += 1
        if c == "S":
            n -= 1
        if c == "E":
            e += 1
        if c == "W":
            e -= 1

    if n == 0 and e == 0:
        print("YES")
    else:
        print("NO")

if __name__=="__main__":
    solve()

Submission status: Wrong Answer

Solution code:
def solve():
    n, e = 0, 0
    for c in input():
        if c == "N":
            n += 1
        if c == "S":
            n -= 1
        if c == "E":
            e += 1
        if c == "W":
            e -= 1
        if n == 0 and e == 0:
            print("YES")
    else:
        print("NO")

if __name__=="__main__":
    solve()

Submission status: Wrong Answer

Solution code:
#AGC003A

s=raw_input()
l=[s[i] for i in xrange(len(s))]
if l.count('N')==l.count('S') or l.count('E')==l.count('W'):
 print "Yes"
else:
 print "No"

Submission status: Wrong Answer

Solution code:
#AGC003A

s=raw_input()
l=[s[i] for i in xrange(len(s))]
if l.count('N')==l.count('S') and l.count('E')==l.count('W'):
 print "Yes"
else:
 print "No"

Submission status: Wrong Answer

Solution code:
s = input()

upDown = 0
rightLeft = 0

for i in s:
    if i == "N": upDown += 1
    if i == "S": upDown -= 1
    if i == "W": rightLeft -= 1
    if i == "E": rightLeft += 1

if upDown == 0 and rightLeft == 0:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
#coding: cp932
Trip = input()
Trip = list(Trip)
check = int(len(set(Trip)))
if len(Trip)==2:
	if (("S" in Trip) & ("N" in Trip)) or (("E" in Trip) & ("W" in Trip)):
		pass
	else:	check=int(0)
if check==int(2) or check==int(4):
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:

#coding: cp932
Trip = input()
Trip = list(Trip)
check = len(set(Trip))
if len(Trip)==2:
	if (("S" in Trip) & ("N" in Trip)) or (("E" in Trip) & ("W" in Trip)):
		pass
	else:	check=0
if check==2 or check==4:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = list(input())


flag_N,flag_E,flag_W,flag_S = -1,-1,-1,-1

if "N" in s:
    flag_N = 1
else:
    flag_N = 0
if "E" in s:
    flag_E = 1
else:
    flag_E = 0
if "W" in s:
    flag_W = 1
else:
    flag_W = 0
if "S" in s:
    flag_S = 1
else:
    flag_S = 0

if (flag_N == 0 or flag_S == 0) or (flag_E == 0 or flag_W == 0):
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
if __name__ == '__main__':
    clist = list(input())
    chars = ['N', 'W', 'S', 'E']
    a = []
    for c in chars:
        a.append(clist.count(c))
    for i in [0, 1]:
        if (a[i] > 0):
            if (a[i + 2] == 0):
                print('No')
                exit()
    print('Yes')

Submission status: Wrong Answer

Solution code:
IN = list(raw_input())
N = 0
S = 0
E = 0
W = 0

for i in range(len(IN)):
    if IN[i] == 'N':
        N += 1
    elif IN[i] == 'S':
        S += 1
    elif IN[i] == 'E':
        E += 1
    elif IN[i] == 'W':
        W += 1

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

Submission status: Wrong Answer

Solution code:
IN = list(raw_input())
N = 0
S = 0
E = 0
W = 0

for i in range(len(IN)):
    if IN[i] == 'N':
        N += 1
    elif IN[i] == 'S':
        S += 1
    elif IN[i] == 'E':
        E += 1
    elif IN[i] == 'W':
        W += 1

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

Submission status: Wrong Answer

Solution code:
S0=input()
N=E=W=S=False
for i in range(len(S0)):
    if S0[i]=='N':
        N=True
    elif S0[i]=='E':
        E=True
    elif S0[i]=='W':
        W=True
    else:
        S=True

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
temp = input()
s = temp.count("S")
e = temp.count("E")
n = temp.count("N")
w = temp.count("W")
if (s == n & w == e):
 print ("Yes")
else:
 print ("No")

Submission status: Wrong Answer

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

if (n == s) and (e == w):print "YES"
else: print "NO"

Submission status: Wrong Answer

Solution code:
if __file__.startswith('/tmp/'):
	import sys; sys.stdin = open('input.txt')

x, y = 0, 0

for c in raw_input().strip():
	if c == 'N':
		y -= 1
	elif c == 'W':
		x += 1
	elif c == 'S':
		y += 1
	else:
		x -= 1

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

Submission status: Wrong Answer

Solution code:
import sys
from collections import defaultdict
line = sys.stdin.readline().strip()

char_count = defaultdict(lambda: 0)

for char in line:
    char_count[char] = char_count[char] + 1

if (char_count["N"] != char_count["S"]) or (char_count["W"] != char_count["E"]):
    print "No"
else:
    print "Yes"

Submission status: Wrong Answer

Solution code:
import numpy as np
s = np.array(list(raw_input()))
num_n = (s == 'N').sum()
num_e = (s == 'E').sum()
num_w = (s == 'W').sum()
num_s = (s == 'S').sum()
if num_n == num_s and num_e == num_w:
    print 'Yes'
else:
    print 'No'

Submission status: Wrong Answer

Solution code:
s = input()
N = 0
S = 0
W = 0
E = 0
for i in range(len(s)) :
    str = s[i]
    if str == 'N' :
        N = 1
    elif str == 'S':
        S = 1
    elif str == 'W':
        W = 1
    elif str == 'E':
        E = 1
if (N-S)==0 and (W-E)==0 :
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding: UTF-8
s = raw_input()

if 'N' in s and 'W' in s and 'S' in s and 'E' in s:
    print "Yes"
else :
    print "No"

Submission status: Wrong Answer

Solution code:
import numpy as np
s = np.array(list(raw_input()))
num_n = (s == 'N').sum()
num_e = (s == 'E').sum()
num_w = (s == 'W').sum()
num_s = (s == 'S').sum()
if num_n == num_s and num_e == num_w:
    print 'yes'
else:
    print 'no'

Submission status: Wrong Answer

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

if n-s !=0 and n*s==0:
    print('NO')
    exit()
    
if w-e !=0 and w*e==0:
    print('NO')
    exit()

print('YES')

Submission status: Wrong Answer

Solution code:
IN = list(raw_input())
N = 0
S = 0
E = 0
W = 0

i = 0
IN.append(0)
while IN[i] != 0:
    if IN[i] == 'N':
        N += 1
    elif IN[i] == 'S':
        S += 1
    elif IN[i] == 'E':
        E += 1
    elif IN[i] == 'W':
        W += 1
    i+=1

if len(IN):
    print 'No'
else:
    if (N == S) and (E == W):
        print 'yes'
    else:
        print 'no'

Submission status: Wrong Answer

Solution code:
import math,sys
s = list(raw_input())
if len(s) == 0:
    print "Yes"
    sys.exit()
if s.count("N") == s.count("S") == 0:
    if "E" in s and "W" in s:
        print "Yes"
        sys.exit()
if s.count("E") == s.count("W") == 0:
    if "N" in s and "S" in s:
        print "Yes"
        sys.exit()
print "No"

Submission status: Wrong Answer

Solution code:
s = input()
n = len(s)
str_set = set([i for i in s])

if len(str_set) % 2 == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
IN = list(raw_input())
N = 0
S = 0
E = 0
W = 0

i = 0
IN.append(0)
while IN[i] != 0:
    if IN[i] == 'N':
        N += 1
    elif IN[i] == 'S':
        S += 1
    elif IN[i] == 'E':
        E += 1
    elif IN[i] == 'W':
        W += 1
    i+=1

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
IN = list(raw_input())
N = 0
S = 0
E = 0
W = 0

i = 0
IN.append(0)
while IN[i] != 0:
    if IN[i] == 'N':
        N += 1
    elif IN[i] == 'S':
        S += 1
    elif IN[i] == 'E':
        E += 1
    elif IN[i] == 'W':
        W += 1
    i+=1

if (N == S) and (E == W):
    print 'yes'
else:
    print 'no'

Submission status: Wrong Answer

Solution code:
s=raw_input()
cntn=0
cnts=0
cnte=0
cntw=0
for i in s:
    if i=="S":
        cnts+=1
    elif i=="E":
        cnte+=1
    elif i=="N":
        cntn+=1
    else:
        cntw+=1
if cntn%2==cnts%2 and cntw%2==cnte%2:
    print("Yes")
else:
    print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll

s = raw_input()
N = S = W = E = 0
for si in s:
    if si == "N":
        N += 1
    if si == "S":
        S += 1
    if si == "W":
        W += 1
    if si == "E":
        E += 1
print "Yes" if N*S*W*E > 0 else "No"

Submission status: Accepted

Solution code:
s = input()
flag = [0] * 4
for i in range(len(s)):
  if s[i] == "N":
    flag[0] = 1
  elif s[i] == "S":
    flag[1] = 1
  elif s[i] == "W":
    flag[2] = 1
  else:
    flag[3] = 1
if flag[0] == flag[1] and flag[2] == flag[3]:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
s = input(); a = b = c = d = 0
if "N" in s: a = 1
if "W" in s: b = 1
if "S" in s: c = 1
if "E" in s: d = 1
print("Yes") if a == c and b == d else print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from collections import Counter


def read():
    S = input().strip()
    return S,


def solve(S):
    D = Counter(S)
    if D["N"] != 0 and D["S"] == 0 or D["N"] == 0 and D["S"] != 0:
        return "No"
    if D["E"] != 0 and D["W"] == 0 or D["E"] == 0 and D["W"] != 0:
        return "No"
    return "Yes"


if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))

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

Submission status: Accepted

Solution code:
s = input()

check = [0]*4

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

Submission status: Accepted

Solution code:
S = input()
A = [0, 0, 0, 0]
for i in range(len(S)):
  if S[i] == "N":
    A[0] = 1
  elif S[i] == "S":
    A[1] = 1
  elif S[i] == "E":
    A[2] = 1
  else:
    A[3] = 1
if A[0] ^ A[1] == A[2] ^ A[3] == 0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
S = input()
s_set = set()
for s in S:
  s_set.add(s)
if len(s_set) == 4:
  print('Yes')
elif len(s_set) == 2 and (('W' in s_set and 'E' in s_set) or \
('S' in s_set and 'N' in s_set)):
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
import sys
def input():
  return sys.stdin.readline().rstrip()

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

def func(S):
  for x in S:
    ma[x]=1
  if ma["N"]!=ma["S"]:
    return False
  if ma["W"]!=ma["E"]:
    return False
  return True

S=input()
print("Yes" if func(S) else "No")

Submission status: Accepted

Solution code:
S = input()

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

if n > 0:
    a += 1
if s > 0:
    a -= 1
if w > 0:
    a += 2
if e > 0:
    a -= 2

if a == 0:
    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')
d = 0
if n > 0:
  d += 1
if s > 0:
  d -= 1
if w > 0:
  d += 2
if e > 0:
  d -= 2
  
if d == 0:
  ans = 'Yes'
else:
  ans = 'No'

print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8

def main():
    S = input()
    dic = {'N':0, 'S':0, 'E':0, 'W':0}
    ans = 'No'

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

    if (dic['N'] == 0 and dic['S'] == 0) or (dic['N'] > 0 and dic['S'] > 0):
        if (dic['E'] == 0 and dic['W'] == 0) or (dic['E'] > 0 and dic['W'] > 0):
            ans = 'Yes'

    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s = input()

d = [c in s for c in 'NSEW']
if d[0] == d[1] and d[2] == d[3]:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
#方角が南北/東西でセットであればよさげ
    s = input().rstrip()
    s = set(s)
    WE={'W','E'}
    NS={'N','S'}
    all_direction={'N', 'E', 'S', 'W'}

    if s == set(WE):
        print("Yes")
    elif s == set(NS):
        print("Yes")       
    elif s == set(all_direction):
        print("Yes")
    else:
        print("No")

if __name__=="__main__":
    main()