60分求调
查看原帖
60分求调
577263
sea_bird楼主2024/10/11 14:01
#include<bits/stdc++.h>

using namespace std;
bool tf=true;
int main(){
	freopen("a.in","r",stdin);
	freopen("a.out","w",stdout);
	int j;
	string ch;
	string str;
	int cnt=0,w;
	getline(cin,ch);

	getline(cin,str);
	for(int i=1;i<=str.size()-ch.size()+1;i++){
		tf=true;
		for(j=1;j<=ch.size();j++){
			if((i-1)>0&&str[i-2]!=' '){
				tf=false;
				break;
			}
			cout<<char(toupper(str[i+j-2]))<<" "<<char(toupper(ch[j-1]))<<endl;
			if(toupper(str[i+j-2])!=toupper(ch[j-1])){
				
				tf=false;
				break;
			}
			
		}
		j-=1;
		if(tf&&cnt==0){
			w=i-1;
		}
		if(tf) cnt++;
	}
	if(cnt){
		cout<<cnt<<" "<<w<<endl;
	}
	else{
		cout<<-1<<endl;
	}
	return 0;
}
2024/10/11 14:01
加载中...