Compile error

This code worked:

# Complete the checkMagazine function below.
function checkMagazine(magazine, note)
    d = Dict{String,Int}()
    #magazine, note = split(magazine), split(note)
    #println(magazine)
    #println(note)
    for word in magazine
        d[word] = get(d, word, 0) + 1
    end
    for word in note
        if get(d, word, 0) > 0
            d[word] -=1
        else
            print("No")
            return
        end
    end

    #println(d)
    print("Yes")
    return
end

mn = split(readline(stdin))

#m = parse(Int32, mn[1])

#n = parse(Int32, mn[2])

magazine = split(readline(stdin))

note = split(readline(stdin))

checkMagazine(magazine, note)

If it is your teacher that suggested hackerrank, I would advise to you suggest to them to find better tools. It is completely stupid and frustrating for the site to give you bad code outside of the function and ask you to just fill in the function. I had to change the code the site already gives to get a pass.

2 Likes