summaryrefslogtreecommitdiff
path: root/avg-seg-len
diff options
context:
space:
mode:
Diffstat (limited to 'avg-seg-len')
-rwxr-xr-xavg-seg-len9
1 files changed, 9 insertions, 0 deletions
diff --git a/avg-seg-len b/avg-seg-len
new file mode 100755
index 0000000..ee68827
--- /dev/null
+++ b/avg-seg-len
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+
+lens = []
+while line = STDIN.gets
+ lens << line.strip.split.size
+end
+
+puts lens.inject(:+)/lens.size.to_f
+