文章

116

粉丝

0

获赞

119

访问

6.4k

头像
字符串去特定字符 题解:
P1362 哈尔滨工业大学机试
发布于2026年1月30日 15:07
阅读数 40

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

int main(){
	string str;
	while(getline(cin,str)){//字符串可能包含空格,使用getline读取更为稳妥
		char c;
		cin >> c;
		str.erase(remove(str.begin(), str.end(), c), str.end());
		cout << str << endl;
	}
	return 0;
}	

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发