Ahmed_Negm

Untitled

Apr 19th, 2022
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. #include<iostream>
  2. #include<cmath>
  3. #include<iomanip>
  4. #include<algorithm>
  5. #include<cstdlib>
  6. #include<cstring>
  7. #include<vector>
  8. #include<utility>
  9.  
  10. #define ll long long
  11. #define sz(x) int(x.size())
  12. #define all(x) x.begin(),x.end()
  13. using namespace std;
  14.  
  15. void Fast_IO(){
  16.     ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  17.     #ifndef ONLINE_JUDGE
  18.         freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  19.     #endif
  20. }
  21.  
  22.  
  23.  
  24.  
  25.  
  26. void solve(){
  27.   string s;
  28.   cin>>s;
  29.   string m="";
  30.   for(int i=0; i<sz(s); i++){
  31.       if(s[i]=='W' && s[i+1]=='U' && s[i+2]=='B'){
  32.           if(sz(m)>1) m+=' ';
  33.           i+=2;
  34.       }else m+= s[i];
  35.   }
  36. cout<<m;
  37.  
  38.  
  39.  
  40. }
  41.  
  42. int main(){
  43.     Fast_IO();
  44. int t =1;
  45. //cin>>t;
  46. while(t--){
  47. solve();
  48. }
  49. return 0;
  50. }  
Advertisement
Add Comment
Please, Sign In to add comment