208A - Dubstep - CodeForces Solution


strings *900

Please click on ads to support us..

Python Code:

dub = str(input())
title = dub.split("WUB")

for i in title:
  if i != "":
    print(i, end = " ")
  

C++ Code:

/* 
:::::::
.
AUTHOR :- rk.ttps25 
.
:::::::
*/
 
//**************** INCLUDE ****************************************************//
 
#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
#include <iomanip>
#include <map>
#include <list>
#include <random>
#include <algorithm>
#include <string>
#include <set>
#include <unordered_set>
#include <tuple>
#include <vector>
#include <map>
#include <fstream>
 
using namespace std;
 
//**************** TYPEDEF *****************************************************//
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
 
//**************** TEMPLATE ****************************************************//
 
template <class T>
T maxim(T x,T y){
    return x>y?x:y;
}
template <class T>
T minim(T x,T y){
    return x>y?y:x;
}
 
//**************** DEFINE ******************************************************//
 
#define fi                   first
#define se                   second
#define pb                   push_back
#define mp                   make_pair
#define endl                 '\n'
#define all(x)               (x).begin(), (x).end()
#define fr(i,a,b)            for(int i = a; i < b; i++)
#define rep(i,a,b)           for(ll i = a; i < b; i++)
#define repr(i,a,b)          for(ll i = b-1; i >= a; i--)
#define MOD                  1000000007                               
#define MOD1                 998244353                               
#define si                   set <int>
#define vi                   vector <int>
#define vl                   vector <ll>
#define pii                  pair <int, int>
#define pll                  pair <ll, ll>
#define vpii                 vector <pii>
#define vpll                 vector <pll>
#define mii                  map <int, int>
#define mpi                  map <pii, int>
#define mll                  map <ll, ll>
#define min3(a, b, c)        min(c, min(a, b))
#define min4(a, b, c, d)     min(d, min(c, min(a, b)))
#define input(x)             ll x; cin >> x
 
 
#define fast_cin()                      \
    ios_base::sync_with_stdio(false);   \
    cin.tie(nullptr);                   \
    cout.tie(nullptr)                                  
                                      
//**************** FUNCTION ******************************************************//

int gcd(int a,int b){
    while(a!=b){
        if(a>b) a=a-b;
        else b=b-a;
    }
    return a;
}

void judge(){
    #ifndef ONLINE_JUDGE
	freopen("input.txt",  "r",  stdin);
	freopen("Error.txt","w",stderr);
	freopen("output.txt", "w", stdout);
    #endif
    
}
 
/* ASCII VALUE
A=65,Z=90
a=97,z=122
0=48,9=57
*/
void solve(){
    string s;
    ll c=1;
    cin>>s;
    for(ll i=0;i<s.size();){
        if(s[i]=='W' && s[i+1]=='U' && s[i+2]=='B'){
            i+=3;
            if(!c){
                cout<<" ";
            }
            continue;
        }
        else
        {
            c=0;
            cout<<s[i];
            i+=1;
        }
    }
}    
 
/* ...................MAIN.......................*/
 
signed main() {
    
    fast_cin();     
    judge(); 
    
	int rk=1;
	//cin>>rk;
    while(rk--){
	    solve();
	}
	
	cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
	
	return 0;
	
}
// THE END**********************
 
/*
.
.
*/


Comments

Submit
0 Comments
More Questions

1691B - Shoe Shuffling
1706A - Another String Minimization Problem
1695B - Circle Game
1702B - Polycarp Writes a String from Memory
1701A - Grass Field
489C - Given Length and Sum of Digits
886B - Vlad and Cafes
915A - Garden
356A - Knight Tournament
1330A - Dreamoon and Ranking Collection
1692B - All Distinct
1156C - Match Points
1675A - Food for Animals
1328C - Ternary XOR
1689A - Lex String
1708B - Difference of GCDs
863A - Quasi-palindrome
1478A - Nezzar and Colorful Balls
1581B - Diameter of Graph
404A - Valera and X
908A - New Year and Counting Cards
146A - Lucky Ticket
1594C - Make Them Equal
1676A - Lucky
1700B - Palindromic Numbers
702C - Cellular Network
1672C - Unequal Array
1706C - Qpwoeirut And The City
1697A - Parkway Walk
1505B - DMCA