这道题目意思很简单,
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
char s[300];
int main()
{
int len ,i;
int flag=0;
cin>>s;
len=strlen(s);
i=0;
while(1)
{
if(s[i]=='W'&&s[i+1]=='U'&&s[i+2]=='B')
i+=3;
else
break;
}
while(1)
{
if(s[len-1]=='B'&&s[len-2]=='U'&&s[len-3]=='W')
len-=3;
else
break;
}
while(i<len)
{
if(s[i]=='W'&&s[i+1]=='U'&&s[i+2]=='B')
{
i+=3;
if(!flag)
{
printf(" ");
flag=1;
}
}
else
{
cout<<s[i];
flag=0;
i++;
}
}
cout<<endl;
return 0;
}