package main import ( "bufio" "os" "strconv" "fmt" "math" ) var s = bufio.NewScanner(os.Stdin) func next() string { s.Split(bufio.ScanWords) s.Scan() return s.Text() } func nextInt() int { i, e := strconv.Atoi(next()) if e != nil { panic(e) } return i } func nextLong() int64 { i, e := strconv.ParseInt(next(), 10, 64) if e != nil { panic(e) } return i } func abs(a int) int { if a < 0 { return -a } return a } func main() { S := next() x := 0 y := 0 for _, c := range S { switch c{ case 'N': y++ case 'E': x++ case 'W': x-- case 'S': y-- } } fmt.Println(math.Sqrt(float64(abs(x*x+y*y)))) }