下面这段代码只能过两个测试点
我的代码可以正确的统计单词数,但无法正确输出单词的位置
#include <bits/stdc++.h>
using namespace std;
int main() {
string a,b;
int c=0,d,k=0;
cin >> a;
for(int i = 0;i < a.size();++i){
if(isupper(a[i]))a[i] += 32;
}
cout << a << endl;
while(cin >> b){
k++;
for(int i = 0;i < b.size();++i){
if(isupper(b[i]))b[i] += 32;
}
if(a==b){
if(!c){
d = k;
}
c++;
}
}
if(!c)cout << -1;
else cout << c << " " << d;
return 0;
}