#K51377. Ransom Note Construction
Ransom Note Construction
Ransom Note Construction
You are given two strings: a ransom note and a magazine. Your task is to determine whether you can construct the ransom note using letters from the magazine. Each letter in the magazine can only be used once.
Note: The letters are case-sensitive and you only need to consider the frequency of each character.
Example:
If the ransom note is "hello" and the magazine is "ollhebg", then the answer is True because each letter needed to form "hello" appears at least once in the magazine. However, if the magazine were "helbg", the answer would be False.
inputFormat
The input is provided via stdin and consists of two lines. The first line contains the ransom note string, and the second line contains the magazine string.
outputFormat
Output to stdout a single line: True
if the ransom note can be constructed from the magazine, or False
otherwise.
hello
ollhebg
True
</p>