提交时间:2024-01-23 15:19:26
运行 ID: 124637
#include<bits/stdc++.h> using namespace std; int const maxn = 100005; string a[maxn]; int main(){ int n = 0; while(cin >> a[++n]); sort(a + 1, a + 1 + n); int t = a[1].length(); for (int i = 2; i <= n; i++){ int j = 0; while(a[i][j] == a[i-1][j] && j < a[i-1].length()) j++; t += a[i].length() - j; } cout << t + 1 << endl; }