import java.io.*; class Process { private String S; Process(String S) { this.S = S; } double getResult() { // 各方角の文字の数を格納する配列 // 添え字の小さい順から、北、東、西、南 var directionCount = new int[4]; for(int i = 0; i < S.length(); i++) { switch(S.charAt(i)) { case 'N': directionCount[0]++; break; case 'E': directionCount[1]++; break; case 'W': directionCount[2]++; break; case 'S': directionCount[3]++; break; } } // 東西方向の移動距離 int horizontalDistance = Math.abs(directionCount[1] - directionCount[2]); // 南北方向の移動距離 int verticalDistance = Math.abs(directionCount[0] - directionCount[3]); return Math.sqrt(Math.pow(horizontalDistance, 2) + Math.pow(verticalDistance, 2)); } } public class Main { public static void main(String[] args) throws IOException { var bufferedReader = new BufferedReader(new InputStreamReader(System.in)); var printWriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); // 入力 String S = bufferedReader.readLine().trim(); // 処理および出力 printWriter.println((new Process(S)).getResult()); bufferedReader.close(); printWriter.close(); } }