提交时间:2024-01-22 14:37:09

运行 ID: 122204

#include <bits/stdc++.h> using namespace std; string a[8005]; int main() { int n = 0; while(cin >> a[++n]) n--; sort(a + 1 , a + n + 1); int t = a[1].length(); int j = 0; for(int i = 2;i <= n;i++) { while(a[i][j] == a[i - 1][j] && j < a[i - 1].length()) j++; t += a[i].length() - j; } cout << t + 1; return 0; }