提交时间:2024-01-23 14:58:07
运行 ID: 124552
#include<bits/stdc++.h> using namespace std; string s; int main() { int len=0; while(cin>>ss[++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; }