提交时间:2024-01-22 22:10:22

运行 ID: 123395

#include <bits/stdc++.h> using namespace std ; string s [114514] ; int main ( ) { int cur = 0 ; while ( cin >> s [++ cur] ) { continue ; } sort ( s + 1 , s + n + 1 ) ; int sum = s [1] . length ( ) ; for ( int i = 2 ; i <= cur ; i ++ ) { int tl = 1 ; while ( s [i - 1] . substr ( 0 , tl ) == s [i] . substr ( 0 , tl ) && tl <= s [i] . length ( ) ) { tl ++ ; } s += s [i] - tl ; } cout<< tl + 1 << endl ; return 0 ; }