$ ./guess_the_languageProgramming Languages
Programming Languages · medium · #589

Which programming language is this?

words = ["apple", "avocado", "banana"]
index = words.each_with_object(Hash.new { |h, k| h[k] = [] }) do |w, acc|
  acc[w[0]] << w
end
p index

Answer: Ruby

each_with_object with a do |w, acc| ... end block and a Hash.new { |h, k| ... } default are Ruby.
Play Programming Languages ▸