I have wordlist.txt that separated by new line.
If I specify number of quotas to use for each alphabet for example
n: 1
e: 1
w: 1
b: 1
o: 2
k: 1
Remain alphabets quota is 0.
How to construct a sentence from given quotas of alphabet that must be spent all until zero and based on words that defined in wordlist.txt?
For example, from given alphabet quotas, it will returning "new book" or "book new". Word order doesn't matter.
Where "new" and "book" has been exists in wordlist.txt.
So list of possible sentences might be like this:
new book
book new
bow neko
neko bow
Suppose there are few new words in
wordlist.txtto handle multiple anagram:if
bookandkoobsorted, both will have same value, it'sbkoo. The same value of words is considered asanagram_id.Instead of using defined quota, I can just write the string directly that represent quota of alphabet, because when sorted, it will be same.
Returning output: