1 2 3 4 5 6 7 8 9
#!/usr/bin/env ruby lens = [] while line = STDIN.gets lens << line.strip.split.size end puts lens.inject(:+)/lens.size.to_f