summaryrefslogtreecommitdiff
path: root/avg-seg-len
blob: ee68827b84848d57c76305624f374be28f849b61 (plain)
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