Ruby Examples

This commit is contained in:
2026-01-15 14:01:21 +09:00
commit cf3d7d3296
76 changed files with 1191 additions and 0 deletions

13
level4/40.rb Executable file
View File

@@ -0,0 +1,13 @@
#!/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