| 记录编号 | 
        153681 | 
        评测结果 | 
        WWWWWWWWWW | 
    
    
        | 题目名称 | 
        173.词链 | 
        最终得分 | 
        0 | 
            
    
    
        | 用户昵称 | 
         new ioer | 
        是否通过 | 
        未通过 | 
    
    
        | 代码语言 | 
        C++ | 
        运行时间 | 
        0.121 s  | 
    
    
        | 提交时间 | 
        2015-03-18 19:20:36 | 
        内存使用 | 
        1.26 MiB  | 
        
    
    
    
    		显示代码纯文本
		
		#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
struct trie{
	int p;
	trie *c[26];
	trie(){
		p=0;
		for(int i=0;i<26;i++) c[i]=NULL;
	}
};
int n,len,res,ans;
char buf[60],ch[1000000],*ptr=ch;
void in(int &x){
	x=0;
	while(*ptr<48) ptr++;
	while(*ptr>47) x=x*10+*ptr++-48;
}
void readln(char *c){
	int cnt=0;
	while(*ptr<60) ptr++;
	while(*ptr>60) c[cnt++]=*ptr++;
}
void ins(int i,trie *&o){
	if(o==NULL) o=new trie;
	else res+=o->p;
	if(i+1==len){
		o->p=1,ans=max(res+1,ans);
		return;
	}
	ins(i+1,o->c[buf[i+1]-'a']);
} 
int main(){
	freopen("link.in","r",stdin);
	freopen("link.out","w",stdout);
	fread(ch,1,1000000,stdin);
	in(n);
	trie *root=new trie;
	while(n--) res=0,readln(buf),len=strlen(buf),ins(0,root->c[buf[0]-'a']);
	printf("%d",ans);
}