Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
160835 刘轻松 统计特定单词数 C++ Wrong Answer 1 MS 272 KB 583 2026-09-26 15:05:59

Tests(0/11):


Code:

#include<iostream> #include<cstring> using namespace std; string a,b; int main(){ cin>>a; getline(cin,b); int lena = a.size(),lenb = b.size(); for(int i=0;i<lena;i++){ if(a[i]>='A'&&a[i]<='Z') a[i] = a[i]+32; } for(int i=0;i<lenb;i++){ if(b[i]>='A'&&b[i]<='Z') b[i] = b[i]+32; } int first=-1; first = b.find(a); if(first==-1){ cout<<-1<<endl; return 0; } int cnt=1,k=first; while(first != -1){ b.erase(first,lena); first = -1; first = b.find(a); if(first != -1) cnt++; } cout<<cnt<<" "<<k<<endl; return 0; }


Run Info:

------Input------
alun is the best teacher of TCJY ALUN
------Answer-----
1 28
------Your output-----
-1