You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**[⬆ Back to Top](#javascript-coding-challenges-for-beginners)**
1250
+
1251
+
## 39. Dubstep
1252
+
1253
+
Mike works as a DJ in the best London 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 (that don't contain `WUB`). To make the dubstep remix of this song, Mike 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.
1254
+
1255
+
For example, a song with words "I AM X" can transform into a dubstep remix as `WUBWUBIWUBAMWUBWUBX` and cannot transform into `WUBWUBIAMWUBX`.
1256
+
1257
+
Recently, Johnny has heard Mike's new dubstep track, but since he isn't into modern music, he decided to find out what was the initial song that Mike remixed. Help Johnny restore the original song.
1258
+
1259
+
*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
1260
+
1261
+
*Output*: Return the words of the initial song that Mike used to make a dubsteb remix. Separate the words with a space.
0 commit comments