strs = gets.to_s.chomp.split("") e = strs.count("E") n = strs.count("N") s = strs.count("S") w = strs.count("W") result = [] we = w - e sn = s - n if we > 0 result.push we elsif we < 0 result.push we.abs end if sn > 0 result.push sn elsif sn < 0 result.push sn.abs end p 0 if result.empty? p Math.hypot(result[0], result[1] ||= 0) unless result.empty?