Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
95617 | 冯诚阳 | 统计特定单词数 | C++ | Wrong Answer | 1 MS | 276 KB | 515 | 2024-10-31 19:23:57 |
#include<iostream> #include<cstring> using namespace std; int main(){ string s1,s2; int a,s=0,l,w; getline(cin,s1); getline(cin,s2); for (int i=0;i<s1.length();i++){ if (s1[i]>='A'&&s1[i]<='Z') s1[i]=s1[i]+32; } for (int i=0;i<s2.length();i++){ if (s2[i]>='A'&&s2[i]<='Z') s2[i]=s2[i]+32; } w=s2.find(s1); if (w==-1){ cout<<-1<<endl; return 0; } else{ l=s1.length(); a=w; while(a!=-1){ s++; s2.erase(a,l); a=s2.find(s1); } cout<<s<<" "<<w<<endl; return 0; } }
------Input------
alun Alunis the best teacher of TCJY alun
------Answer-----
1 32
------Your output-----
2 0