diff options
Diffstat (limited to 'sample/occur.rb')
-rw-r--r-- | sample/occur.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sample/occur.rb b/sample/occur.rb new file mode 100644 index 0000000000..12e469d20a --- /dev/null +++ b/sample/occur.rb @@ -0,0 +1,10 @@ +freq = {} +while gets() + for word in $_.split(/\W+/) + freq[word] +=1 + end +end + +for word in freq.keys.sort + printf("%s -- %d\n", word, freq[word]) +end |