提交时间:2024-04-26 13:08:52
运行 ID: 144684
#include<bits/stdc++.h> using namespace std; string s[10086]; int len,length; int main (){ while(cin >> s[++len])continue; sort(s + 1, s + len + 1); 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; }