x=0;y=0 gets.chomp.chars.each{|c| y-=1 if c=="N" x-=1 if c=="E" x+=1 if c=="W" y+=1 if c=="S" } p Math::sqrt(x*x+y*y)