文章

71

粉丝

97

获赞

5

访问

16.6k

头像
删除字符串 题解: replace与find函数
P1026 贵州大学2019机试
发布于2024年2月19日 16:30
阅读数 298

#include<iostream>
#include<string>
using namespace std;

int main() {
    string str;
    getline(cin, str);
    string s = "gzu";
    int m = s.length();
    while (str.find(s)!=string::npos) {
        int find = str.find(s);
        str.replace(find,m,"");
    }
    cout << str;
    return 0;
}

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发