Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
47953 | 舒晨扬 | 统计特定单词数 | C++ | Accepted | 3 MS | 276 KB | 742 | 2023-05-14 14:43:58 |
//include<bits/stdc++.h>erase #include<iostream> #include<string> #include<cctype> using namespace std; int main(){ //freopen("a.in","r",stdin); //freopen("b.out","w",stdout); string a,b; getline(cin,a); getline(cin,b); int cnt = 0,c = 0; for(int i = 0;i < a.size();i++){ a[i] = tolower(a[i]); } for(int i = 0;i < b.size();i++){ b[i] = tolower(b[i]); } a = ' ' + a + ' '; b = ' ' + b + ' '; for(int i = 0;i < b.size();i++){ //0123456 // lema // l lema l if(a[cnt] == b[i]){ cnt++; } else{ cnt =1; } if(cnt == a.size()){ cnt = 1; c++; } } if(c!=0){ cout << c << " "; cout << b.find(a) << endl; } else{ cout << "-1" << endl; } return 0; }