Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int len,i,j=0,x;
- bool f=true;
- string s, ans;
- cin>>s;
- len=s.size();
- for(i=0;i<len; )
- {
- if(s[i]=='W' && s[i+1]=='U' && s[i+2]=='B')
- {
- i+=3;
- ans.push_back(' ');
- j++;
- }
- else
- {
- if(f)
- {
- f=false;
- x=j;
- }
- ans.push_back(s[i]);
- i++;
- }
- }
- for(i=x;i<ans.size();i++)
- {
- if(ans[i]==' ' && ans[i+1]==' ')continue;
- else cout<<ans[i];
- }
- //cout<<ans;
- printf("\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement