def check_if_ransom_note(magazines, note):
    count = Counter()
    pm, pn = 0, 0

    while pn < len(note) and pm < len(magazines):
        char_note = note[pn]
        if count[char_note]>0:
            count[char_note] -= 1
            pn += 1
        else:
            char_magazine = magazines[pm]
            count[char_magazine] += 1
            pm +=1

    return pn == len(note)
dataset/ETHPy150Open bt3gl/Python-and-Algorithms-and-Data-Structures/src/builtin_structures/ransom_note.py/check_if_ransom_note/original