5 help


#1

puts "something write"
text = gets.chomp
words = text.split(" ")
frequencies = Hash.new{0}

words.each do |word|
frequencies = {"fun" => 3}
end
frequencies["word"] += 1


#2

I think you are trying to manually set "fun" frequency to 3. Instead, you should let the code make it automatically, so your code should be:

puts "something write"
text = gets.chomp
words = text.split(" ")
frequencies = Hash.new(0) ## use parenthesis here

words.each do |word|
frequencies["word"] += 1
end