#39 Help the bookseller ! 


A bookseller has lots of books classified in 26 categories labeled A, B, ... Z. Each book has a code of 3, 4, 5 or more capitals letters. The first letter of a letter is the capital letter of the book category. In the bookseller's stocklist each code is followed by a space and a positive integer n (int n> = 0) which indicates the quantity of books in this code in stock.


For example an extract of one of the stocklists could be:


L = {"ABART 20", "CDXEF 50", "BKWRK 25", "BTSQZ 89", "DRTYM 60"}.

or


L = ["ABART 20", "CDXEF 50", "BKWRK 25", "BTSQZ 89", "DRTYM 60"] or ....

You will be given a stocklist (L) and a list of categories in capital letters.


  M = {"A", "B", "C", "W"}

or


  M = ["A", "B", "C", "W"] or ...

and your task is to find all the books of L with codes belonging to each category.


For the lists L and M, you have to return the string (in Haskell / Clojure a list of pairs):


  (A: 20) - (B: 114) - (C: 50) - (W: 0)

"BKWRK" and "BTSQZ", 50 corresponding to "CDXEF" and 0 to category 'W', where A, B, C and W are the categories, since there is no code beginning with W.


If L or M are empty return string is "" (Clojure should return an empty array instead).


#38  Highest Scoring Word


Given a string of words, you need to find the highest scoring word.


Each letter of a word scores points according to it's position in the alphabet: a = 1, b = 2, c = 3 etc.


You need to return the highest scoring word as a string.


If two words score the same, return the word that appears earliest in the original string.


All letters will be lowercase and all inputs will be valid.




#34 Write Number in Expanded Form


Write Number in Expanded Form

You will be given a number and you will need to return it as a string in Expanded Form. For example:


Kata.expandedForm(12); # Should return "10 + 2"

Kata.expandedForm(42); # Should return "40 + 2"

Kata.expandedForm(70304); # Should return "70000 + 300 + 4"

NOTE: All numbers will be whole numbers greater than 0.



#32 Dubstep


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

songDecoder("WUBWEWUBAREWUBWUBTHEWUBCHAMPIONSWUBMYWUBFRIENDWUB")

  // =>  WE ARE THE CHAMPIONS MY FRIEND


+ Recent posts