30pts求调内容且闭关
查看原帖
30pts求调内容且闭关
834247
L1ghtF0xy楼主2025/7/24 17:26
#include<bits/stdc++.h>
using namespace std;
string a;
string tot;
int cnt=-1;
int cntt;
int tim=0;
int start;
bool target=0;
int longg;
void figure(int x,int y){
	if(longg-1!=(y-x))
		return;
	for(int i=0;i<longg;i++){
		if(a[i]>='A' && a[i]<='Z')
			a[i]+=32;
		if(tot[x+i]>='A' && tot[x+i]<='Z')
			tot[x+i]+=32;
		if(a[i]!=tot[x+i])
			return;
		}
	tim++;
	if(target==0)
		cntt=cnt;
	target=1;
	}
int main(){
	getline(cin,a);
	getline(cin,tot);
	longg=a.length();
	tot+=' ';
	for(int i=0;i<=tot.length();i++){
		if(tot[i]==' '){
			cnt++;
			figure(start,i-1);
			start=i+1;
			}
		}
	if(target)
		cout<<tim<<' '<<cntt;
	else
		cout<<-1;
    return 0;
	}
2025/7/24 17:26
加载中...