Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
115166 | 冯诚阳 | 统计特定单词数 | C++ | Wrong Answer | 1 MS | 272 KB | 1016 | 2025-03-29 16:02:20 |
#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() using namespace std; int main(){ string a,b; int la,lb; getline(cin,a); getline(cin,b); int j=0,c=0,d; 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+' '; la=a.size(); lb=b.size(); for(int i=0;i<lb;i++){ if(a[j]==b[i]){ j++; if(j==la){ c++; if(c==1) d=i-(la-1); j=0; } } else if(b[i]==' ') j=1; else j=0; } if(c==0) cout<<-1; else cout<<c<<" "<<d; return 0; }
------Input------
alun Alunis the best teacher of TCJY alun
------Answer-----
1 32
------Your output-----
2 0