Trie模版
int trie[1000010][26];
int num[1000010]={0};
int pos = 1;
void Insert(char *s)
{
int i;
int c = 0;
for(i=0;i<strlen(s);i++)
{
int n = s[i]-'a';
if(trie[c][n]==0)
trie[c][n] = pos++;
c = trie[c][n];
num[c]++;
}
}
int Find(char *s)
{
int i,c = 0;
for(i=0;i<strlen(s);i++)
{
int n = s[i]-'a';
if(trie[c][n]==0)
return 0;
c = trie[c][n];
}
return num[c];
}
int num[1000010]={0};
int pos = 1;
void Insert(char *s)
{
int i;
int c = 0;
for(i=0;i<strlen(s);i++)
{
int n = s[i]-'a';
if(trie[c][n]==0)
trie[c][n] = pos++;
c = trie[c][n];
num[c]++;
}
}
int Find(char *s)
{
int i,c = 0;
for(i=0;i<strlen(s);i++)
{
int n = s[i]-'a';
if(trie[c][n]==0)
return 0;
c = trie[c][n];
}
return num[c];
}