Files
ruby-examples-1/level4/40.rb
2026-01-15 14:01:21 +09:00

13 lines
241 B
Ruby
Executable File

#!/usr/bin/ruby
# -*- coding: utf-8 -*-
=begin
단어 빈도수 계산 프로그램
=end
words = "This is a test This is only a test".downcase.split(" ")
result = Hash.new
words.each { |w| result[w] = result[w]?result[w]+1:1}
puts result