print((function (f, s) return f(s) end)(function (s) local x,y = 0,0 for i=1,#s do local c = s:sub(i,i) if c=="E" then x=x+1 end if c=="W" then x=x-1 end if c=="S" then y=y-1 end if c=="N" then y=y+1 end end return math.sqrt(math.pow(x,2)+math.pow(y,2)) end, io.stdin:read("*l")))