提交时间:2024-01-23 15:26:19

运行 ID: 124689

#include <bits/stdc++.h> using namespace std; string a[100005]; int main() { ios::sync_with_stdio(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 < a[i - 1].length()) j++; t += a[i].length() - j; } cout << t + 1 << '\n'; return 0; }