Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
115155 夏梓瑞 统计特定单词数 C++ Accepted 1 MS 280 KB 923 2025-03-29 15:34:44

Tests(11/11):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min()\fabs() #include<ctime> #include<cstdlib> #include<cstring> using namespace std; int main(){ string a; getline(cin,a); string b; getline(cin,b); int w,l,c,s=0; for(int i=0;i<a.size();i++){ if(a[i]>='a' && a[i]<='z') a[i]-=32; } for(int i=0;i<b.size();i++){ if(b[i]>='a' && b[i]<='z') b[i]-=32; } a=' '+a+' '; b=' '+b+' '; w=b.find(a); if(w==-1){ cout<<w; return 0; } else{ l=a.size(); c=w; while(c!=-1){ s++; b.erase(c,l); c=b.find(a); } }cout<<s<<' '<<w; return 0; }