题解 | 字符串去特定字符
字符串去特定字符
https://www.nowcoder.com/practice/d5d0450134db4cb994a1b323a35262da
//KY169 字符串去特定字符
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
string s;
char op;
int main()
{
while(getline(cin,s)){
cin>>op;
string res="";
for(int i=0;i<s.size();i++){
if(s[i]!=op) res+=s[i];
}
cout<<res<<"\n";
}
return 0;
}


查看5道真题和解析