Hat’s Words HDU - 1247
题目链接:https://vjudge.net/problem/HDU-1247
题目:
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.
You are to find all the hat’s words in a dictionary.
InputStandard 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.
OutputYour output should contain all the hat’s words, one per line, in alphabetical order.Sample Input
a ahat hat hatword hziee wordSample Output
ahat hatword
题意:就是给你一个单词列表,然后单词可以从中间拆成任意两部分,只要这两部分都是单词列表里的就把这个单词输出,否则不输出
思路:利用字典树将所有单词插入字典树中,单词个数均赋予1,然后后面处理的时候再利用strncpy函数将单词分开,分别存入s1,s2中,注意末尾要赋予“