20分蒟蒻求调,样例全过
查看原帖
20分蒟蒻求调,样例全过
1219873
Wuzetong楼主2024/9/3 22:03
#include<bits/stdc++.h>
using namespace std;
int main(){
    int ans=-1,cnt=0,k=0;
    string s,t;
    cin>>t;
    for(int j=0;j<t.size();j++)
        t[j]=tolower(t[j]);
    while(cin>>s){
        for(int j=0;j<s.size();j++)
            s[j]=tolower(s[j]);
        if(s==t){
            if(ans==-1) ans=k;
            cnt++;
        }
        k+=s.size()+1;
    }
    if(ans==-1){
        cout<<ans;
        return 0;
    }
    else cout<<cnt<<" "<<ans;
    return 0;
}
2024/9/3 22:03
加载中...