20分!
查看原帖
20分!
313731
touxi楼主2021/10/9 19:35

2,4点对了


#include<bits/stdc++.h>
using namespace std;
string st,s;
int sum=0,where=0,f=1;
int main()
{
	cin>>st;
	for (int i=0;i<=st.size()-1;i++)
	if (st[i]>='A'&&st[i]<='Z') st[i]=st[i]-'A'+'a';
	while(cin>>s)
	{
	
		for (int i=0;i<=s.size()-1;++i)
		if (s[i]>='A'&&s[i]<='Z') s[i]=s[i]-'A'+'a';
		if (s==st)
		{
			sum++;
			f=0;
		}
			if (f==1)
		{
			where++;
		}
	}
	if (sum==0) cout<<-1;
	else cout<<sum<<' '<<where;
	return 0;
} 
2021/10/9 19:35
加载中...