let n = 0, e = 0; require("fs").readFileSync("/dev/stdin", "utf8").split("").forEach(c => { switch (c) { case 'N': n++; break; case 'S': n--; break; case 'E': e++; break; case 'W': e--; break; } }); console.log(Math.sqrt(n*n + e*e));