public class No_113 { static int X; static int Y; static void move(char c) { switch (c) { case 'N': Y++; break; case 'E': X++; break; case 'S': Y--; break; case 'W': X--; break; } } public static void main(String[] args) { java.util.Scanner sc = new java.util.Scanner(System.in); String s = sc.next(); char[] direction = s.toCharArray(); for (char c : direction) { move(c); } System.out.println(Math.sqrt(X * X + Y * Y)); sc.close(); } }