import java.util.Scanner;

public class Run {
    public static void main (String arg[]) {
        Scanner scan = new Scanner(System.in);
        String S = scan.next();
        int[] c = {0, 0};
        for (int i = 0; i < S.length(); i++) {
            news(S.charAt(i), c);
        }
        System.out.println(Math.pow((c[0]*c[0] + c[1]*c[1]), 0.5));
    }

    public static void news (char x, int[] c) {
        if (x=='N') c[1]++;
        else if (x=='E') c[0]++;
        else if (x=='W') c[0]--;
        else if (x=='S') c[1]--;
    }
}