Possible Duplicate:
How can I find the words consist of the letters inside the keyword in Lua?
I am trying to find words consist of letters inside the keyword. However, the letters shouldn't be used again once it's detected that it's inside the word.
i keep the words in the dictionary.
For example I have the keyword: "asdasdas"
My code says hi in these conditions
consistLetters("asdasdas","asdas")
consistLetters("asdasdas","sad")
consistLetters("asdasdas","sss")
However it also says hi when i consume all of the "s" in the keyword which is not what i want:
consistLetters("asdasdas","ssss")
How to stop this? Thank you.
EDIT: I solved my problem and shared it as an answer. I hope it'll be helpful.