20分,不知道哪错了(悬赏关注~)
查看原帖
20分,不知道哪错了(悬赏关注~)
723171
fqEason楼主2022/9/30 21:51
#include <bits/stdc++.h>
using namespace std;
string Find;
string word[1000001];
int cnt;
int ans,first;
bool flag;
int main() {
	cin >> Find;
	transform(Find.begin(),Find.end(),Find.begin(),::tolower);
	cnt=0;
	while(cin >> word[cnt]) {
		transform(word[cnt].begin(),word[cnt].end(),word[cnt].begin(),::tolower);
		if (word[cnt]==Find) {
			ans++;
			first=min(first,cnt);
		}
		cnt++;
	}
	if (ans!=0)
		cout << ans << " " << first;
	else cout << -1;
	return 0;
}
2022/9/30 21:51
加载中...