呵呵呵

许诺  •  1个月前


include

include

include

using namespace std; int main() {

string line;
while (getline(cin, line) && line != "#") {
    istringstream iss(line);
    string s, t;
    if (!(iss >> s >> t)) {
        continue;
    }
    int count = 0;
    size_t len = t.length();
    if (len == 0) {
        cout << 0 << endl;
        continue;
    }
    size_t pos = 0;
    while (pos + len <= s.length()) {
        size_t found = s.find(t, pos);
        if (found != string::npos) {
            count++;
            pos = found + len;
        } else {
            break;
        }
    }
    cout << count << endl;
}
return 0;

} 快感谢我


评论:

早写出来了


bloodseeker  •  1个月前

请先登录,才能进行评论