首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
曾不会
2026年2月1日 10:01
字符串去特定字符 题解:
P1362
回复 0
|
赞 0
|
浏览 59
#include<stdio.h> #include<string.h> using namespace std; int main() { char s[1000]; char ch; while(fgets(s,1000,stdin)!=NULL) { int l=strlen(s); s[l-1]='\0&...
yauqq
2026年1月30日 15:07
字符串去特定字符 题解:
P1362
回复 0
|
赞 1
|
浏览 37
#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; }
18296543453
2025年2月15日 13:13
字符串去特定字符 题解:
P1362
回复 0
|
赞 2
|
浏览 1.6k
#include <iostream> #include<string> using namespace std; char str[1000010]; char ch; int main() { cin>>str; cin>>ch; for(int i=0;str[i];i++){ if(str[i]==ch)continue; else cout<<str[i]; } ...
小王桐学
2024年2月23日 20:50
字符串去特定字符 题解:C
P1362
回复 0
|
赞 4
|
浏览 939
#include <stdio.h> #include <string.h> int main() { char s[1000],c; while(scanf("%s",s) != EOF) { scanf(" %c",&c); char *p = s; while(*p != '\0') { if(*p != c) printf("%c",*p); p++; } printf("\n"); } return 0; }
莫小七
2020年2月24日 11:57
1362字符串去特定字符(用string函数)
P1362
回复 0
|
赞 4
|
浏览 9.5k
#include<iostream> #include<cstring> #include<string> using namespace std; int main() { string s; while (cin >> s) { char c; cin >> c; int pos = 0; while ((pos = s.find(c)) != -1) { s.erase(pos, 1); } cout << s << en...
题目
字符串去特定字符
题解数量
5
发布题解
在线答疑
热门题解
1
1362字符串去特定字符(用string函数)
2
字符串去特定字符 题解:C
3
字符串去特定字符 题解:
4
字符串去特定字符 题解:
5
字符串去特定字符 题解: