文章

1

粉丝

0

获赞

3

访问

140

头像
删除字符串2 题解:
P1027 贵州大学机试题
发布于2026年3月18日 23:27
阅读数 140

#include<string>
#include<cctype>
#include<iostream>
#include<algorithm>
using namespace std;
string toLower(string s){
    string result=s;
    transform(result.begin(),result.end(),result.begin(),::tolower);
    return result;
}
int main(){
    string s;
    getline(cin,s);
    
    string temp;
    temp=toLower(s);
    int pos=temp.find("gzu");
    while(pos!=string::npos){

        s.erase(pos,3);
        temp.erase(pos,3);
                pos=temp.find("gzu");
    
    }
    cout<<s<<endl;
    return 0;
}

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发