if ARGV.size != 1
	abort "Usage: #$0 <airport code>"		# $0 is a global for this file's name
end

airport_code_to = ARGV.shift
num_flights = 0

while line = gets
	# Airline,flight#,AirportFrom,FromCode,AirportTo,ToCode,...\n
        # Example line: UA,5209,ZRH,1678,ORD,3830,Y,0,333
	_, _, _, _, to, _ = line.split(/,/)
	if to == airport_code_to then
		num_flights += 1
	end
end

puts "Found #{num_flights} flights to #{airport_code_to}"
