Skip to content

Instantly share code, notes, and snippets.

@bright23
Created November 30, 2016 01:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bright23/29f9f13d76014a7726a9d6cf7c65faa5 to your computer and use it in GitHub Desktop.
Save bright23/29f9f13d76014a7726a9d6cf7c65faa5 to your computer and use it in GitHub Desktop.
dic = Hash.new(0)
while line = ARGF.gets
line.downcase!
while line.sub!(/[a-z]+/,"")
word = $&
dic[word] += 1
end
end
p dic.sort{|a,b|b[1] <=> a[1]}[0...5]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment