首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
xsw
2026年2月4日 12:49
删除字符串 题解:
P1026
回复 0
|
赞 0
|
浏览 12
#include<iostream> using namespace std; int main() { string s; cin >> s; string str; for (int i = 0; i < s.size(); i ++ ) { if (s.substr(i, 3) == "gzu") i += 2; else str += s[i]; } cout << str << endl; return 0; }
mlx
2026年1月31日 16:46
删除字符串 题解:
P1026
回复 0
|
赞 1
|
浏览 36
#include<iostream> using namespace std; string str; int main() { cin>>str; while(str.find("gzu")!=string::npos) { int index=str.find("gzu"); str.erase(index,3); } cout<<str; return 0; }
yauqq
2026年1月28日 16:12
删除字符串 题解:
P1026
回复 0
|
赞 0
|
浏览 52
#include<bits/stdc++.h> using namespace std; int main(){ string str; cin >> str; while(str.find("gzu")!= string::npos){ str.erase(str.find("gzu"),3); } cout<< str <<endl; return 0; }
奶龙大王
2026年1月25日 15:26
删除字符串 题解:
P1026
回复 0
|
赞 0
|
浏览 64
暴力+memset注意事项 #include <iostream> #include <cmath> // 必须包含 cmath #include<vector> #include<algorithm> #include<cstring> #include<stdlib.h>//memset头文件 using namespace std; int main() { string s; g...
曾不会
2026年1月25日 09:49
删除字符串 题解:
P1026
回复 0
|
赞 0
|
浏览 78
//栈 #include<stdio.h> #include<stack> #include<string.h> using namespace std; int main() { char s[110]; scanf("%s",s); int l=strlen(s); stack<char> hash; for...
senna
2026年1月24日 22:41
删除字符串 题解:for循环暴力
P1026
回复 0
|
赞 1
|
浏览 55
#include<bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; string res = ""; for(int i = 0; i < s.size(); i ++){ if(s[i] == 'g' && s[i+1] == '...
bro
2026年1月19日 20:09
删除字符串 题解:c++采用字符串相关函数写法
P1026
回复 0
|
赞 2
|
浏览 115
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; string ss = "gzu"; while(s.find(ss) != string::npos) { s.erase(s.find(ss),3); &...
jerryking
2026年1月16日 15:06
删除字符串 题解:c语言解决
P1026
回复 0
|
赞 1
|
浏览 130
#include <stdio.h> #include <string.h> //删除字符串中的字串 void deleteSubStr(char *str,char *substr) { int len1=strlen(str),len2=strlen(substr); while(strstr(str,substr)) { int pos=strstr(str,substr)-str; ...
无名1
2025年9月2日 18:39
删除字符串 题解:C++
P1026
回复 0
|
赞 5
|
浏览 740
#include<bits/stdc++.h> using namespace std; string sShan(string s){ string s1; int l=0; while(l<s.length()){ if(s[l]=='g'&&s[l+1]=='z'&&s[l+2]=='u'){ l+=3; }else{ s1+=s[l]; l++; } } return s1; } int main(){ string s; cin>&g...
阿灿
2025年3月15日 06:01
删除字符串 题解:
P1026
回复 0
|
赞 18
|
浏览 1.3k
#include<bits/stdc++.h> using namespace std; int main(){ string input,ans; int i; getline(cin,input); while(input.find("gzu")!= string::npos){ input.erase(input.find("gzu"),3); } cout<<input<<endl; return 0; } erase find string::npos
1
2
3
4
题目
删除字符串
题解数量
33
发布题解
在线答疑
热门题解
1
删除字符串 题解:老老实实,做子串匹配!
2
删除字符串 题解:
3
删除字符串 题解:c 语言解决
4
删除字符串 题解:采用find
5
删除字符串 题解:
6
删除字符串 题解:C
7
删除字符串 题解:C++
8
题解:删除字符串
9
删除字符串 题解:strstr() + memmove()
10
删除字符串(跟前面同学的有点不一样)