文章

119

粉丝

68

获赞

90

访问

19.9k

头像
字符串的差 题解:按照t里面把s的全部一样的都删完
P1832 山东大学机试
发布于2025年2月19日 14:34
阅读数 32

#include <bits/stdc++.h>
using namespace std;

int main(){
    string s,t;
    while(cin>>s>>t){
        for(auto x:t){
            for(int i=0;i<s.size();i++){
                if(s[i]==x){
                    s.erase(i--,1);
                }
            }
        }
        cout<<s<<endl;
        
    }
}

注意索引,删除后索引需要前置

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发