Created
April 22, 2013 20:29
-
-
Save generalzhou/5438256 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
puts "Type a word:" | |
list = [] | |
while true | |
input = gets.chomp | |
break if input == "" | |
list << input | |
puts "Type another word (or press enter to finish):" | |
end | |
puts "Congratulations! Your dictionary has #{list.length} words:" | |
list_sorted = list.sort do |a, b| | |
a.upcase <=> b.upcase | |
end | |
puts list_sorted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment