Last active
May 29, 2019 13:12
-
-
Save just806me/72a49ed246b66e296aa765116dbcc913 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LETTER_REGEX = /^[[:alpha:]]$/u.freeze | |
line = STDIN.gets.downcase | |
dict = Hash.new 0 | |
line.each_char { |c| dict[c] += 1 if c =~ LETTER_REGEX } | |
dict.sort_by { |key, value| value }.reverse.each { |key, value| puts "#{ key }: #{ value }" } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment