using static System.Math;
using System;

public class Hello
{
    public static void Main()
    {
        var d = new string[] { "N", "E", "S", "W" };
        var s = Console.ReadLine().Trim();
        var sL = s.Length;
        var a = new int[4];
        for (int i = 0; i < 4; i++)
            a[i] = sL - s.Replace(d[i], "").Length;
        var ns = a[0] - a[2];
        var ew = a[1] - a[3];
        var ans = Sqrt(ns * ns + ew * ew);
        Console.WriteLine(ans);
    }
}