s = gets.chomp.chars Point = Struct.new :x, :y point = Point.new 0, 0 s.each {|c| case c when 'N' point.y += 1 when 'E' point.x += 1 when 'W' point.x -= 1 when 'S' point.y -= 1 end } puts Math.sqrt(point.x ** 2 + point.y ** 2)