| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 152719 | 冯诚阳 | 统计特定单词数 | C++ | Accepted | 1 MS | 276 KB | 974 | 2026-05-01 18:59:51 |
#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,c=""; getline(cin,a); getline(cin,b); int cnt=0,pos1=-1,i; for(i=0;a[i]!='\0';i++) if(a[i]>='A'&&a[i]<='Z') a[i]+=32; for(i=0;b[i]!='\0';i++) if(b[i]>='A'&&b[i]<='Z') b[i]+=32; for(i=0;b[i]!='\0';i++){ if(b[i]!=' ') c=c+b[i]; else{ if(c==a){ if(pos1==-1){ pos1=i-a.size(); } cnt++; }c=""; } } if(c==a){ if(pos1==-1){ pos1=i-a.size(); } cnt++; } if(pos1==-1) cout<<-1; else cout<<cnt<<" "<<pos1; return 0; }