| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 160849 | 李昱龙 | 统计特定单词数 | C++ | Accepted | 1 MS | 276 KB | 624 | 2026-09-26 15:30:28 |
#include<bits/stdc++.h> using namespace std; int main(){ string a,b,s; int first=-1,cnt=0; getline(cin,a); getline(cin,b); b+=" "; int len=a.size(),len1=b.size(); for(int i=0;i<len;i++){ if(a[i]>='A'&&a[i]<='Z'){ a[i]=a[i]+32; } } for(int i=0;i<len1;i++){ if(b[i]>='A'&&b[i]<='Z'){ b[i]=b[i]+32; } } for(int i=0;i<len1;i++){ if(b[i] != ' '){ s+=b[i]; } else{ if(s==a){ if(first==-1){ first =i-s.size(); } cnt++; } s=""; } } if(first==-1){ cout<<-1; } else{ cout<<cnt<<" "<<first; } return 0; }