Published:
Updated:

https://codeforces.com/problemset/problem/208/A


Solution

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Solution {
    static void printWords(String input) {
        String[] inputToArr = input.split("WUB");
        for (String s : inputToArr) {
            if (s.equals("")) {
                continue;
            }
            System.out.print(s + " ");
        }
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String input = br.readLine();
        printWords(input);
        br.close();
    }
}

Leave a comment