Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
95616 | 万隽宇 | 统计特定单词数 | C++ | Wrong Answer | 1 MS | 272 KB | 854 | 2024-10-31 19:03:44 |
#include<iostream> // cin\cout\endl #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() using namespace std; string a1,a2; int main(){ getline(cin,a1); int c=0; int len1=a1.length(),e=0; getline(cin,a2); int len2=a2.length(); for(int i=0;i<len1;i++){ if(a1[i]>='A'&&a1[i]<='Z'){ a1[i]=a1[i]+32; } } for(int i=0;i<len2;i++){ if(a2[i]>='A'&&a2[i]<='Z'){ a2[i]=a2[i]+32; } } int d=a2.find(a1); if(d==-1){ cout<<d; return 0; } for(int i=0;i<len2;i++){ int j=0; for(j=0;j<len1;j++){ if(a1[i+j]!=a2[j]){ break; } } if(j==c){ c++; } } cout<<c<<' '; cout<<d; return 0; }
------Input------
alun Alunis the best teacher of TCJY alun
------Answer-----
1 32
------Your output-----
1 0