Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有以下方法,它列出了用户输入的所有可能排列:
此代码的输出将是单词上帝(单词在字典中)
dgo dog gdo god odg ogd
我的目标是过滤掉与我的字典中的单词不匹配的结果..
dog god
如何做到这一点?
我认为这应该可以正常工作:
do { if (searchWord(input)) { cout << input << endl; } } while (next_permutation(input.begin(), input.end()));