[hdu 1247]Hat’s Words [Trie 图]
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
a
ahat
hat
hatword
hziee
word
Sample Output
ahat
hatword
题目的意思是其实就是找出一个单词,前半部是一个出现过的单词,后半部也是,记住,要严格满足这个条件
所以,其实也就是先查找一个单词的是否有前缀,再用这个单词除去前缀的部分查找是否存在一个这样的单词
虽然题目说按字典序输出,但本身已经是按字典序输入了,所以排序也就省了
#include<iostream>
#i