http://acm.hdu.edu.cn/showproblem.php?pid=1251
#include<iostream>
using namespace std;
struct dictree
{
    
struct dictree *child[26];
    
int num;
}
;
int main()
{
    
int i;
    
char word[11];
    
struct dictree root;// = new dictree;
    for(i=0;i<26;i++)
        root.child[i] 
= NULL;
    root.num 
= 0;
    
while(cin.getline(word,11),word[0])//输入方法很niu
    {
        
struct dictree *now = &root;
        
char *tmp = word;
        
while(*tmp)
        
{
            
if(now->child[*tmp-'a']==NULL)
            
{
                now
->child[*tmp-'a']=new dictree;
                now
=now->child[*tmp-'a'];
                
for(i=0;i<26;i++)
                    now
->child[i] = NULL;
                now
->num = 1;
            }

            
else
            
{
                now
=now->child[*tmp-'a'];
                now
->num ++;
            }

            tmp
++;
        }

    }
    
    
while(cin.getline(word,11),cin && word[0])
    
{
        
int mins=100000;
        
struct dictree *now = &root;
        
char *tmp = word;
        
while(*tmp)
        
{
            now
=now->child[*tmp-'a'];
            
if(!now)
            
{
                mins 
= 0;
                
break;
            }

            
if(now->num < mins)
                mins 
= now->num;
            tmp
++;
        }

        cout
<<mins<<endl;
    }

    
return 0;
}