package main import ( "bufio" "fmt" "io" "math" "os" ) func solve(in io.Reader, out, err io.Writer) { ns, ew, temp := 0, 0, []byte{} fmt.Fscan(in, &temp) for i := range temp { switch temp[i] { case 'N': ns++ case 'S': ns-- case 'E': ew++ case 'W': ew-- } } fmt.Fprintln(out, math.Sqrt(float64(ns*ns+ew*ew))) } func main() { br := bufio.NewReaderSize(os.Stdin, int(1e3)) solve(br, os.Stdout, os.Stderr) }