题解 | 字符串去特定字符

字符串去特定字符

https://www.nowcoder.com/practice/d5d0450134db4cb994a1b323a35262da

#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;

int main() {
    string s;
    char c;
    while(cin>>s>>c)
    {
        for(int i=0;i<s.size();i++){
            if(s[i]==c)
            {
                s.erase(i,1);
                i--;
            }

        }
        cout<<s<<endl;
    }
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

码农索隆:谁问你了 举报了 删了,求你了 我要哭了 我一点也不眼红 我要跳楼
点赞 评论 收藏
分享
09-13 17:43
已编辑
北京化工大学 硬件开发
易才一飞:感觉项目写细节一些吧,掌握技能和校内经历感觉占比太大,而且这是找嵌软还是硬件呢,似乎大家都说要有针对的写相关技术才好吧
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务