| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 152716 | 冯诚阳 | 统计特定单词数 | C++ | Compile Error | 0 MS | 0 KB | 828 | 2026-05-01 18:40:22 |
#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; getline(cin,a); getline(cin,b); int cnt=0,post1=-1; size_t pos=0; for(int i=0;a[i]!='\0';i++) if(a[i]>='A'&&a[i]<='Z') a[i]+=32; for(int i=0;b[i]!='\0';i++) if(b[i]>='A'&&b[i]<='Z') b[i]+=32; while(b.find(a,pos)!=string::npos){ pos=b.find(a,pos); if(pos1==-1){ pos1=b.find(a,pos); } cnt++; pos+=a.size(); } if(pos1!=-1) cout<<cnt<<" "<<pos1<<endl; else cout<<-1; return 0; }
Main.cc: In function 'int main()':
Main.cc:21:12: error: 'pos1' was not declared in this scope
if(pos1==-1){
^
Main.cc:28:8: error: 'pos1' was not declared in this scope
if(pos1!=-1)
^
Main.cc:11:15: warning: unused variable 'post1' [-Wunused-variable]
int cnt=0,post1=-1;
^