Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
3497 吴奕希 统计特定单词数 C++ Wrong Answer 0 MS 268 KB 488 2024-06-09 11:27:20

Tests(8/11):


Code:

# include<iostream> using namespace std; string a, b; int main(){ getline(cin, a); getline(cin, b); int cnt = 0, s1 = a.size(), s2 = b.size(); for(int i = 0; i < s1; i++)if(a[i]<97)a[i]+=32; for(int i = 0; i < s2; i++)if(b[i]<97)b[i]+=32; int r = b.find(a); int f = r; if(r>s2||r<0){cout<<-1; return 0;} while(r<s2&&r>-1){ cnt++; b = b.erase(r, s1); r = b.find(a); } cout<<cnt<<" "<<f; return 0; }


Run Info:

------Input------
alun Alunis the best teacher of TCJY alun
------Answer-----
1 32
------Your output-----
2 0