import scala.math._ object Main { def main(args: Array[String]) { val sc = new java.util.Scanner(System.in) val s = sc.nextLine var x, y = 0 for (c <- s) c match { case 'N' => y += 1 case 'E' => x += 1 case 'W' => x -= 1 case 'S' => y -= 1 } println(sqrt(x*x + y*y)) } }