use std::io; fn main() { let mut s = String::new(); io::stdin().read_line(&mut s).ok(); let (mut x, mut y) = (0, 0); s.trim().chars().for_each(|c| match c { 'N' => y += 1, 'E' => x += 1, 'W' => x -= 1, 'S' => y -= 1, _ => unreachable!(), }); let hypotenuse = f64::from(x).hypot(f64::from(y)); println!("{}", hypotenuse); }