代码如下
#include<map>
#include<iostream>
using namespace std;
map<string,int>mp;
map<string,int>ans;
map<string,bool>vis;
int cnt=0;
void lop(string &x){
for(int i=0;i<x.size();i++){
if(x[i]>='A'&&x[i]<='Z'){
x[i]=x[i]-'A'+'a';
}
}
return ;
}
int main(){
string s;
string tmp;
cin>>s;
lop(s);
while(cin>>tmp){
lop(tmp);
mp[tmp]++;
if(vis[tmp]==false){
ans[tmp]=cnt++;
vis[tmp]=true;
}
}
if(mp[s]==0){
cout<<-1;
}else{
cout<<mp[s]<<' '<<ans[s];
}
return 0;
}
样例过了,但只有20分,其他全WA,请问哪里错了?