文章

209

粉丝

0

获赞

845

访问

29.7k

头像
字符串替换 题解:
P2011
发布于2026年1月30日 15:51
阅读数 370

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

int main(){
	string str;
	getline(cin, str);
	for(char &c:str){
		c = tolower(c);
	}	
	if(str.find("tantan") == string::npos)
		cout << "not find" <<endl;
	else{
		while(str.find("tantan")!= string::npos){
			int pos = str.find("tantan");
			str.replace(pos,6,"baibai");
		}
		cout << str << endl;	
	}		
	return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发