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

Tests(0/11):


Code:

# include<iostream> using namespace std; string a, b; int main(){ getline(cin, a); getline(cin, b); int cnt = 0, r = b.find(a), s1 = a.size(), s2 = b.size(); 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<<f<<" "<<cnt; return 0; }


Run Info:

------Input------
alun OK Alun is the best teacher of TCJY
------Answer-----
1 3
------Your output-----
-1