提交时间:2024-01-23 14:59:07
运行 ID: 124558
#include<bits/stdc++.h> using namespace std; string s[1000001]; int main() { int len=0; while(cin>>s[++len]) continue; sort(s+1,s+len+2); 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; }