# demonstrates file handling
# source = open(ARGV.first)
# copy   = open(ARGV.first+".bak", 'w')
# copy.write(source.read)
# source.close
# copy.close


# file handling and iterators

# counting words in a file
wc = 0
File.readlines(ARGV.first).each do |line|
  wc = wc + line.split(" ").length
end
puts wc

