<s> __author__ = "<STR_LIT>" <EOL> from collections import Counter <EOL> def check_if_ransom_note ( magazines , note ) : <EOL> count = Counter ( ) <EOL> pm , pn = <NUM_LIT:0> , <NUM_LIT:0> <EOL> while pn < len ( note ) and pm < len ( magazines ) : <EOL> char_note = note [ pn ] <EOL> if count [ char_note ] > <NUM_LIT:0> : <EOL> count [ char_note ] -= <NUM_LIT:1> <EOL> pn += <NUM_LIT:1> <EOL> else : <EOL> char_magazine = magazines [ pm ] <EOL> count [ char_magazine ] += <NUM_LIT:1> <EOL> pm += <NUM_LIT:1> <EOL> return pn == len ( note ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> magazines1 = "<STR_LIT>" <EOL> magazines2 = "<STR_LIT>" <EOL> note = "<STR_LIT>" <EOL> print ( check_if_ransom_note ( magazines1 , note ) ) <EOL> print ( check_if_ransom_note ( magazines2 , note ) ) </s>
