https://www.luogu.com.cn/problem/P1308
#include<bitsdc++.h>
using namespace std;
string s,a;
int ans,t,t1=-1;
int main(){
cin>>s;
int L=s.size();
while(cin>>a){
bool f=0;
t1++;
if(L!=a.size()) continue ;
for(int i=0;i<L;i++){
if(s[i]==a[i]) f=1;
else if(a[i]>='a'&&a[i]<='z'){
a[i]-=32;
if(s[i]==a[i]) f=1;
}
else if(a[i]>='A'&&a[i]<='Z'){
a[i]+=32;
if(s[i]==a[i]) f=1;
}
else{
f=0;
break;
}
}
if(f==1){
ans++;
if(ans==1){
t=t1;
}
}
}
if(ans==0){
cout<<-1<<endl;
return 0;
}
cout<<ans<<' '<<t<<endl;
return 0;
}
有没有大佬能帮我改改代码,或者给我讲讲思路。。。 我直接输出-1得20分,写出代码得10分