So I am making this game kinda like super text twist. I was wondering if there are functions in c++ that lets you know if the guess word is a subset of the scrambled word. Of course, the number of characters would have to match up.


word || scambled word || guess
1.hello || olhel || loo
2.hello || olhel || ole

1.this should be invalid since there is only one 'o' in the original
2. this should be valid since only one 'l' is used up.

Any help, please? It's ok if you will not give a code, just some ideas on how to do this will do. Thanks.

You could store a frequency count of all the letters in the word/scrambled word. Then, make a frequency count of the guess and subtract the guess frequency counts from the stored one. If any of the resulting subtractions is negative, then your guess cannot be a subset of the stored word.