我也不知道第7个点为什么会RE
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
class SC{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer tokenizer = new StringTokenizer("");
public String next() throws Exception{
while(!tokenizer.hasMoreTokens()){
tokenizer = new StringTokenizer(reader.readLine());
}
return tokenizer.nextToken();
}
public int nextInt() throws Exception{
return Integer.parseInt(next());
}
}
public class Main {
static int n;
static int N = 500010;
static int[][] son = new int[N][26];
static int[] cnt = new int[N];
static int idx = 0;
static int max = 0;
static SC sc = new SC();
static ArrayList<String> list = new ArrayList<>();
static void insert(String s){
int p = 0;
int num = 0;
for(int i = 0;i < s.length();i ++){
int u = s.charAt(i) - 'a';
if(son[p][u] == 0) son[p][u] = ++ idx;
p = son[p][u];
if(cnt[p] != 0)
num ++;
}
cnt[p] ++;
max = Math.max(num,max);
}
public static void main(String[] args) throws Exception {
n = sc.nextInt();
while(n -- > 0){
String s = sc.next();
list.add(s);
}
Comparator<String> comparator = new Comparator<String>() {
@Override
public int compare(String o1, String o2) {
return o1.length() - o2.length();
}
};
Collections.sort(list,comparator);
for(String str : list){
insert(str);
}
System.out.println(max + 1);
}
}