| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 158417 | Kevin | 统计特定单词数 | C++ | Wrong Answer | 1 MS | 272 KB | 987 | 2026-08-21 15:40:08 |
#include<bits/stdc++.h> using namespace std; char a[30]; char b[10005]; //转小写函数 char toLow(char c) { if(c>='A'&&c<='Z') return c+32; return c; } int main() { cin.getline(a,30); cin.getline(b,10005); int lena=strlen(a); int lenb=strlen(b); int cnt=0; int first_pos=-1; for(int i=0;i<lenb;i++) { //剩余字符不够,直接结束循环 if(i+lena>lenb) break; bool match=true; for(int j=0;j<lena;j++) { char ca=toLow(a[j]); char cb=toLow(b[i+j]); if(ca!=cb) { match=false; break; } } if(match) { cnt++; if(first_pos==-1) first_pos=i; } } if(cnt>0) { cout<<cnt<<" "<<first_pos<<endl; } else { cout<<-1<<endl; } return 0; }
------Input------
alun Alunis the best teacher of TCJY alun
------Answer-----
1 32
------Your output-----
2 0