Max Score
hard
1. You are given a list of words, a list of alphabets(might be repeating) and score of every alphabet from a to z. 2. You have to find the maximum score of any valid set of words formed by using the given alphabets. 3. A word can not be used more than one time. 4. Each alphabet can be used only once. 5. It is not necessary to use all the given alphabets. Note -> Check out the question video and write the recursive code as it is intended without changing signature. The judge can't force you but intends you to teach a concept.
Constraints
1 <= N <= 14 1 <= length of word <= 15 1 <= M <= 100 1 <= Value of score <= 10
Format
Input
A number N representing number of words N space separated strings A number M representing number of alphabets(might be repeating) M space separated characters 26 numbers representing score of unique alphabets from a to z.
Output
Check the sample ouput and question video.
Example
Sample Input
4
dog cat dad good
9
a b c d d d g o o
1 0 9 5 0 0 3 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0
Sample Output
23
Question Video