提交时间:2024-01-23 15:10:58

运行 ID: 124607

#include <bits/stdc++.h> using namespace std; string a[8005]; int main() { int n = 0; while(cin >> a[++n]) continue; sort(a + 1 , a + n + 1); 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; return 0; }