只有#2和#4过了,求助
查看原帖
只有#2和#4过了,求助
551088
FincheuwYggdrasil楼主2022/10/6 11:59
#include<bits/stdc++.h> 
using namespace std;
string s,t;
int f = -1;
void toli(string &s)
{
	for(int i = 0;i < s.size();i++)
	{
		if(s[i] <= 'Z')
			s[i] += 32;
	} 
}
bool cmp(string s,string t)
{
	if(s.size() != t.size())
		return false;
	for(int i = 0;i < s.size();i++)
	{
		if(s[i] != t[i])
			return false;
	} 
	return true;
}
int main()
{
	cin >> s;
	toli(s);
	int i = 0;
	while(cin >> t)
	{
		toli(t);
		if(cmp(s,t))
		{
			if(!~f)
				f = i;
			i++;
		}
		
	} 
	if(!i)
		printf("-1");
	else
		printf("%d %d",i,f);
    return 0;
}
2022/10/6 11:59
加载中...