提交时间:2024-01-23 15:48:14

运行 ID: 124811

#include<iostream> #include<algorithm> using namespace std; string s[1000010], t; int i = 0, cnt = 0; int main(){ while(cin >> s[i]) i++; sort(s, s + i); // for(int j = 0; j < i; j++) cout << s[j] << endl; for(int j = 1; j < i; j++){ int k = 0; while(s[j][k] == s[j-1][k] && k < s[j - 1].size()) k++; cnt += s[j].size() - k; } cout << cnt + 1 + s[0].size(); return 0; }