提交时间:2024-03-05 17:05:40
运行 ID: 135462
#include<bits/stdc++.h> using namespace std; string s[10086]; int main () { int len = 0; while(cin >> s[++len])continue; sort(s + 1, s + len + 1); int length = 0; for (int i = 1; i <= len; i++) { if (i == 1) { length += s[i].length(); continue; } int tmp = 0; while (s[i][tmp] == s[i - 1][tmp] && tmp < s[i - 1].length())tmp++; length += s[i].length() - tmp; } printf("%d", ++length); return 0; }