文章

166

粉丝

68

获赞

855

访问

61.7k

头像
字符串删除 题解:find函数
P1856 兰州大学机试题
发布于2025年3月13日 11:48
阅读数 161

#include <bits/stdc++.h>

using namespace std;

int main() {
    string s,t;
    while(cin>>s>>t){
        int ct=0;
        while(s.find(t)!=string::npos){
            s.erase(s.find(t),t.size());
            ct++;
        }
        printf("num=%d;S3=",ct);
        cout<<s<<endl;
    }
}

如果让用,就用,如果不让用,建议暴力匹配

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发