HDU - 1247
Description
A hat’s word is a word in the dictionary that is the concatenation of exactly two other words in the dictionary.
You are to find all the hat’s words in a dictionary. Input
Standard input consists of a number of lowercase words, one per line, in alphabetical order. There will be no more than 50,000 words.
Only one case. Output
Your output should contain all the hat’s words, one per line, in alphabetical order.
Sample Input
Sample Output
|
HDU - 1247 Hat’s Words 字典树
最新推荐文章于 2017-07-20 07:38:44 发布
本文介绍了一个简单的算法,用于从字典中找出所有由两个其他单词拼接而成的Hat's Words。通过构建字典树,算法高效地检查每个单词是否能被拆分为两个存在于字典中的子串。

744

被折叠的 条评论
为什么被折叠?



