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