美文网首页
Python小练习

Python小练习

作者: LanceAdd | 来源:发表于2017-10-16 09:54 被阅读0次

主要是自己尝试写的一些比较简单实用的算法,不定时更新,希望大家喜欢

第一题:

数据格式化

就是将一段被插入了其他字符的字符串还原,加粗的地方是核心

Polycarpus 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, Polycarpus 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, Jonny has heard Polycarpus's new dubstep track, but since he isn't into modern music, he decided to find out what was the initial song that Polycarpus remixed. Help Jonny 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

Output

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

Examples

```

song_decoder("WUBWEWUBAREWUBWUBTHEWUBCHAMPIONSWUBMYWUBFRIENDWUB")

# =>  WE ARE THE CHAMPIONS MY FRIEND

```

"""

我这边贴出几位同学的答案以及一个推荐答案

同学一:

同学二:

推荐答案

相关文章

  • python小练习

    1、python内置函数接收用户输入字符串,并将其输出。 encoding:utf-8 str1 = raw_in...

  • Python小练习

    主要是自己尝试写的一些比较简单实用的算法,不定时更新,希望大家喜欢 第一题: 数据格式化 就是将一段被插入了其他字...

  • Python小练习

    Python小练习 @[Python] 问题 之前看了一段时间的Python语言,一直没机会使用,现在机会来了,懒...

  • Python 小练习

    这一节,我们来实现一个简单的 Vector 类。Vector 类有两个属性,为 x,y 坐标,即对应向量的横纵坐标...

  • python小练习

    题目要求: 三个学生对象(属性:姓名、年龄、快乐值、学习值、考试成绩),共学习15天,每5天考一次试,根据各科考试...

  • 第二周-实习总结

    周一 休息-元旦假期 周二 继续上周五python的练习,同时python小练习加两个文件。 patch文件 来将...

  • Something For Practice

    Python Python 练习册,每天一个小程序 Github标星57k+,如何用Python实现所有算法! -...

  • 几道Python小程序练习的多种解法,做出来就表示Python入

    下面由小编开始设题解题: python斐波那契数列python学习群.png 关于Python编程练习题和答案,斐...

  • Python之每日一练QQ头像上加数字

    python入门后需要不断的练习才能加深印象,为了提升自己的python编码能力,特地找了一些python小例子进...

  • One Py Per Day

    偶然看到Python 练习册,每天一个小程序,感觉挺适合Python初学者。这个Project有26个小Proje...

网友评论

      本文标题:Python小练习

      本文链接:https://www.haomeiwen.com/subject/cqfkuxtx.html