/**
poj 1451 T9
在hdu 1298 上WA了,
原来问题出在单词的数目上,审题不慎,字符串长度开始定位10,
没注意到题目说单词数目不超过100。可是竟然不给我RE,返回结果很坑爹额。。。
*/
#include <stdio.h>
#include <string.h>
#define N 50000
struct tireTree
{
int cnt;
tireTree *child[26];
tireTree()
{
cnt = 0;
for(int i = 0; i < 26; ++i)
child[i] = NULL;
}
}tt[N],*spt;
void insert(char *s,int p,tireTree *&rt)
{
tireTree *loc;
loc = rt;
int num;
for(int i = 0; s[i]; ++i)
{
num = s[i] - 'a';
if(loc->child[num] == NULL)
loc->child[num] = new tireTree;
loc = loc->child[num];