Run ID:160852
提交时间:2026-09-26 15:32:34
#include<bits/stdc++.h> using namespace std; string w,t; int main() { getline(cin,w); getline(cin,t); for(int i=0; i<w.size(); i++) { if(w[i]>='A'&&w[i]<='Z') { w[i]+=32; } } for(int i=0; i<t.size(); i++) { if(t[i]>='A'&&t[i]<='Z') { t[i]+=32; } } int f=-1; f=t.find(w); int sum=0; string w1=""; t+=' '; for(int i=0; i<t.size(); i++) { if(t[i]!=' ') { w1+=t[i]; } else { if(w1==w) { if(f==-1) { f=i-w.size(); } sum++; } w1=""; } } return 0; }