嗨,我是 Fly,用 Ruby 寫 Chatbot 並挑戰30天分享心得
為確保不會沒靈感
每日含 Ruby 解題增加內容
https://www.hackerrank.com/domains/tutorials/30-days-of-code
ns = gets.to_i
book = {}
ns.times do |n|
xs = gets.to_s.chomp
page = xs.split(' ')
book[page[0]]=page[1]
end
ns.times do |n|
xs = gets.to_s.chomp
puts book[xs] ? "#{xs}=#{book[xs]}" : 'Not found'
end