Ransom Letter

Published by Matt in

Write a function that returns true if you can use the letters of the first string to create the second string. Letters are case sensitive.

Examples

canBuild("aPPleAL", "PAL") ➞ true

canBuild("aPPleAL", "apple") ➞ false

canBuild("a", "") ➞ true

canBuild("aa", "aaa") ➞ false

Notes

Letters in the first string can be used only once.

Watch a quick demo on how Edabit works.