Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
3498 | 吴奕希 | 统计特定单词数 | C++ | Accepted | 0 MS | 268 KB | 559 | 2024-06-09 11:57:50 |
# include<iostream> using namespace std; string a, b, sts; int f=-1, cnt=0; int main(){ getline(cin, a); getline(cin, b); int cnt = 0, s1 = a.size(), s2 = b.size(); for(int i = 0; i < s1; i++)if(64<a[i]&&a[i]<97)a[i]+=32; for(int i = 0; i < s2; i++)if(64<b[i]&&b[i]<97)b[i]+=32; for(int i = 0; i < s2-1; i++){ sts = ""; for(int k = i; b[k] > 32; k++)sts += b[k]; if(sts==a){cnt++;if(f==-1)f=i;} i += sts.size(); } if(f==-1)cout<<-1; else cout<<cnt<<" "<<f; return 0; }