第18周周赛(大一)--A - Dubstep

A - Dubstep
Crawling in process... Crawling failed Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u

Description

Vasya works as a DJ in the best Berland nightclub, and he often uses dubstep music in his performance. Recently, he has decided to take a couple of old songs and make dubstep remixes from them.

Let's assume that a song consists of some number of words. To make the dubstep remix of this song, Vasya inserts a certain number of words "WUB" before the first word of the song (the number may be zero), after the last word (the number may be zero), and between words (at least one between any pair of neighbouring words), and then the boy glues together all the words, including "WUB", in one string and plays the song at the club.

For example, a song with words "I AM X" can transform into a dubstep remix as "WUBWUBIWUBAMWUBWUBX" and cannot transform into "WUBWUBIAMWUBX".

Recently, Petya has heard Vasya's new dubstep track, but since he isn't into modern music, he decided to find out what was the initial song that Vasya remixed. Help Petya restore the original song.

Input

The input consists of a single non-empty string, consisting only of uppercase English letters, the string's length doesn't exceed 200 characters. It is guaranteed that before Vasya remixed the song, no word contained substring "WUB" in it; Vasya didn't change the word order. It is also guaranteed that initially the song had at least one word.

Output

Print the words of the initial song that Vasya used to make a dubsteb remix. Separate the words with a space.

Sample Input

Input
WUBWUBABCWUB
Output
ABC 
Input
WUBWEWUBAREWUBWUBTHEWUBCHAMPIONSWUBMYWUBFRIENDWUB
Output
WE ARE THE CHAMPIONS MY FRIEND 
 
    
这个题的意思就是将一个字符串中的WUB去掉, 同时要对每个单词之间留出空格,用flag控制,第一个单词前没有空格,将去除WUB的字符串加入空格后给str2 ,并输出
#include <stdio.h>
#include <string.h>
int main()
{
    int i , j = 0 , flag = 0 ;
    char str1[202] , str2[202] ;
    scanf("%s", str1);
    for(i = 0 ; str1[i] != '\0' ; i++)
    {
        if(str1[i]=='W' && str1[i+1] =='U' && str1[i+2]=='B')
        {
            i += 2 ;
            flag = 1 ;
        }
        else
        {
            if(flag==1 && j != 0)
            {
                str2[j] = ' ' ;
                j++ ;
            }
            flag = 0;
            str2[j] = str1[i] ;
            j++ ;
        }
    }
    str2[j] = '\0' ;
    printf("%s\n", str2);
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值