Dubstep

A. Dubstep

Problem

Vasya在最好的Berland夜总会担任DJ,他经常在表演中使用dubstep音乐。最近,他决定将几首老歌进行dubstep混音。

让我们假设一首歌由一定数量的单词组成。让这首歌的dubstep混音,Vasya插入一定数量的单词“<跨类= >“tex-font-style-tt WUB > < /跨度”之前,这首歌的第一个词(可能是零),最后一个词后(可能是零),和单词之间(任何一对之间至少有一个相邻的字),然后男孩融合在一起的所有的单词,包括“<跨类= >“tex-font-style-tt WUB > < /跨度”,在一个字符串并在俱乐部播放这首歌。

例如,含有“I AM X”字样的歌曲可以转换为“WUBWUBIWUBAMWUBWUBX”,而不能转换为“WUBWUBIAMWUBX”。

最近,Petya听了Vasya的新dubstep曲目,但由于他不喜欢现代音乐,他决定找出Vasya重新混音的最初歌曲是什么。帮助Petya恢复原来的歌曲。

Input

输入由一个非空字符串组成,只能由大写英文字母组成,字符串长度不超过 200 字符。保证在Vasya重新混音之前,其中没有包含子字符串“WUB”的单词;Vasya没有改变词序。它还保证最初的歌曲至少有一个词。

Output

打印Vasya用来制作dubsteb混音的初始歌曲的歌词。单词之间用空格隔开。

Examples

Input

WUBWUBABCWUB

Output

ABC

Input

WUBWEWUBAREWUBWUBTHEWUBCHAMPIONSWUBMYWUBFRIENDWUB

Output

WE ARE THE CHAMPIONS MY FRIEND

Note

In the first sample: “WUBWUBABCWUB” = “WUB” + “WUB” + “ABC” + “WUB”. That means that the song originally consisted of a single word “ABC”, and all words “WUB” were added by Vasya.

In the second sample Vasya added a single word “WUB” between all neighbouring words, in the beginning and in the end, except for words “ARE” and “THE” — between them Vasya added two “WUB”.

Code

// #include <iostream>
// #include <algorithm>
// #include <cstring>
// #include <stack>//栈
// #include <deque>//堆/优先队列
// #include <queue>//队列
// #include <map>//映射
// #include <unordered_map>//哈希表
// #include <vector>//容器,存数组的数,表数组的长度
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
string b="WUB";
vector<string> a;

void solve()
{
    string s;
    cin>>s;
    
    while(s.find(b)!=-1)
    {
        ll idx=s.find(b);
        if(!idx) s=s.substr(3,s.size()-3);
        else
        {
            a.push_back(s.substr(0,idx));
            s=s.substr(idx,s.size()-idx);
        }
    }
    a.push_back(s);
    for(auto t:a) cout<<t<<" ";
    cout<<endl;
}

int main()
{
    ll t=1;
    //cin>>t;
    while(t--) solve();
    
    return 0;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Pretty Boy Fox

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值