Check which word from a list can be build based on a list of characters available.
I have been thinking about this for a few days now, and have not been able to figure out how to solve this -- what appears to be a problem that can be solved with arrays, I think
I need to check, whether I can complete / spell a word based on a bunch of characters I have. E.g.
I need to build the words:
and have the characters: a, b, c, d, e, f, g, h, i, i, k, l, n, p, p, t
I can build the word link and php, but not ink, because I am missing a second k
The words in the word list should be (attempted to be) completed top to bottom in the word list
E.g. the result could be a repeat of the list with characters in bold that are available.phplinkg
The problem is not to bold the existing characters, but to take into account the number of each character available.