提交时间:2024-01-23 15:16:43
运行 ID: 124631
#include <bits/stdc++.h> using namespace std; string p[10000]; int main() { int times=0,len1,len2; while (cin>>p[++times]); sort(p+1,p+1+times); int ans=p[1].length(); for (int i=2;i<=times;i++) { int j=0; while (p[i][j]==p[i-1][j]&&j<p[i-1].length()) j++; ans+=p[i].length()-j; } cout<<ans+1<<endl; return 0; }