#include <iostream>
#include <string>
using namespace std;
string a;
int main ( ) {
cin >> a;
int c = a.find ( "WUB" ); //找a中WUB的开始位置。若没有则为 -1
while ( c != -1 ) {
a.replace ( c, 3, " " ); //从位置 c 开始的 3个数 用 “ ”替代
c = a.find ( "WUB" );
}
cout << a << endl;
} codeforces 208A (STL做法)
最新推荐文章于 2019-09-11 21:48:39 发布
, 本文介绍了一个简单的C++程序,该程序通过不断查找并移除输入字符串中的WUB子串,直到字符串中不再包含WUB。使用了标准的C++库函数进行字符串操作。
&spm=1001.2101.3001.5002&articleId=8456092&d=1&t=3&u=a877cc77b31540589385debe76a36b1c)
1133

被折叠的 条评论
为什么被折叠?



