Problem:
Score : 200 points

Problem Statement

Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip.
At the beginning of Day 1, he is at home. His plan is described in a string S of length N.
On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction:

North if the i-th letter of S is N

West if the i-th letter of S is W

South if the i-th letter of S is S

East if the i-th letter of S is E

He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N.

Constraints

1 ≦ | S | ≦ 1000

S consists of the letters N, W, S, E.

Input

The input is given from Standard Input in the following format:

S

Output

Print Yes if it is possible to set each day's travel distance so that he will be back at home at the end of Day N. Otherwise, print No.

Sample Input 1

SENW

Sample Output 1

Yes

If Snuke travels a distance of 1 on each day, he will be back at home at the end of day 4.

Sample Input 2

NSNNSNSN

Sample Output 2

Yes

Sample Input 3

NNEW

Sample Output 3

No

Sample Input 4

W

Sample Output 4

No

Solution in C# (Mono 4.6.2.0) (judge verdict: Accepted)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;
using static System.Math;
using static Math2;
using static io;


class Program
{
    static void Main(string[] args)
    {
        var wrong_answer = new wrong_answer();
        wrong_answer.Solve();
    }
}

public class wrong_answer
{
    const int INF = 1 << 29;
    const long INFL = 1L << 60;
    const int MOD = 1000000007;
    const int MOD2 = 998244353;



    public void Solve()
    {
        var s = str;
        bool N = false;
        bool W = false;
        bool S = false;
        bool E = false;
        if (s.Contains('N')) N = true;
        if (s.Contains('W')) W = true;
        if (s.Contains('S')) S = true;
        if (s.Contains('E')) E = true;
        bool ans = false;
        if (N && S && !E && !W) ans = true;
        if (!N && !S && W && E) ans = true;
        if (N && S && E && W) ans = true;
        yn(ans);
    }

}



public static class Math2
{
    public static long pow(long i, long n, long MOD = 1000000007)
    {
        long res = 1;
        while (n > 0)
        {
            if ((n & 1) != 0) res = res * i % MOD;
            i = i * i % MOD;
            n >>= 1;
        }
        return res;
    }
    public static int pow(int i, int n, int MOD = 1000000007)
    {
        int res = 1;
        while (n > 0)
        {
            if ((n & 1) != 0) res = res * i % MOD;
            i = i * i % MOD;
            n >>= 1;
        }
        return res;
    }

    public static long gcd(long i, long y)
    {
        while (y != 0)
        {
            var r = i % y;
            i = y;
            y = r;
        }
        return i;
    }

    public static long lcm(long i, long y)
    {
        return i * y / gcd(i, y);
    }

    public static BigInteger bgcd(BigInteger i, BigInteger y)
    {
        while (y != 0)
        {
            var r = i % y;
            i = y;
            y = r;
        }
        return i;
    }

    public static BigInteger blcm(BigInteger i, BigInteger y)
    {
        return i * y / bgcd(i, y);
    }

    public static Dictionary<long, int> primefactorization(long N)
    {

        var ret = new Dictionary<long, int>();

        for (long i = 2; i * i <= N; ++i)
        {
            int cnt = 0;
            while (N % i == 0)
            {
                cnt++;
                N /= i;
            }
            if (cnt != 0) ret[i] = cnt;

        }
        if (N >= 2) ret[N] = 1;

        return ret;

    }

    public static List<long> divisorenumrate(long N)
    {
        var ret = new List<long>();

        for (long i = 1; i * i <= N; ++i)
        {

            if (N % i == 0)
            {
                ret.Add(i);
                ret.Add(N / i);
            }

        }

        return ret;

    }

    public static void swap<T>(ref T a, ref T b)
    {
        var i = a;
        a = b;
        b = i;
    }
    public static void chmin<T>(ref T a, T b) where T : IComparable
    {
        if (a.CompareTo(b) > 0) a = b;
    }
    public static void chmax<T>(ref T a, T b) where T : IComparable
    {
        if (a.CompareTo(b) < 0) a = b;
    }

}

public static class io
{
    //in
    public static string str => Console.ReadLine();

    public static string[] strm => str.Split(' ');

    public static long[] longm => strm.Select(long.Parse).ToArray();
    public static int[] intm => strm.Select(int.Parse).ToArray();
    public static char[] charm => str.ToArray();
    public static double[] doublem => strm.Select(double.Parse).ToArray();
    public static long long1 => longm[0];
    public static int int1 => intm[0];
    public static char char1 => charm[0];
    public static double double1 => doublem[0];
    public static void write(string a) => Console.WriteLine(a);
    public static void write(params object[] i) => write(string.Join(" ", i));
    public static void write<T>(IEnumerable<T> a) => write(string.Join(" ", a));
    public static void yn(bool i) { if (i) write("Yes"); else write("No"); }

}