s = gets.chomp x = y = 0 s.each_char do |e| case e when 'N' then y += 1 when 'E' then x += 1 when 'W' then x -= 1 when 'S' then y -= 1 end end puts Math.sqrt(x**2 + y**2)