class Calc0113 EPS = 1e-2 def initialize(args) args = args.map { |l| l.chomp.split(/\s+/) } @s = args.shift.first end def run x = @s.count('N') - @s.count('S') y = @s.count('E') - @s.count('W') Math.sqrt(x ** 2 + y ** 2) end end puts Calc0113.new(STDIN.readlines).run if __FILE__ == $0