import Foundation
func solution(_ name:[String], _ yearning:[Int], _ photo:[[String]]) -> [Int] {
var answer = [Int]()
var dict = [String: Int]()
//name과 yearning을 돌면서 딕셔너리에 넣자.
for i in 0..<name.count {
dict[name[i]] = yearning[i]
}
for i in photo {
var temp = 0
for j in i {
temp += dict[j] ?? 0
}
answer.append(temp)
}
return answer
}