有的数据有前导 0,所以如下的代码会 WA:
#include<iostream>
#include<algorithm>
using namespace std;
signed main() {
ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
string str,arr;
cin>>str;
transform(str.begin(),str.end(),str.begin(),::tolower);
int ans=0,cnt=0;
bool flag=true;
while(cin>>arr) {
transform(arr.begin(),arr.end(),arr.begin(),::tolower);
if(arr==str) {
++ans;
flag=false;
}
if(flag) cnt+=arr.size()+1;
}
if(ans) cout<<ans<<" "<<cnt;
else cout<<-1;
return 0;
}