Код: Выделить всё
#include
using namespace std;
int main() {
string a,b; cin >> a;
b="WUB";
int n;
while(a.find(b)==0){
a.erase(0,3);
}
while(a.find(b)>0){
n=a.find(b);
a.replace(n,3," ");
}
n=a.size();
while(a[--n]==' '){
a.erase(n,1);
}
cout
Подробнее здесь: [url]https://stackoverflow.com/questions/78731817/terminate-called-after-throwing-an-instance-of-stdout-of-range-what-basic[/url]