Picotron, your Grandparents' Favourite Heavy Metal Band P27761


Statement
 

pdf   zip

While Heavy Metal has found mainstream success over the last decades, bringing to stardom thousands of bands with a sonic palette based on distorted riffs and screaming voices, it stills finds it hard to reach popularity in certain demographics. For instance, recent market studies show that it is sadly still uncommon to see death metal acts perform at retirement homes, depriving our elders from the pleasure of growling vocals.

image

It is for this that the industry sees with great hopes the rise of Picotron, a shier take on heavy metal whose call to fame is based on bold statements like “Our amplifiers only go to 4—I guess we can get them to 5 if you insist, but you should ask us with pretty please…” and good ol’ cologne scent that makes their live performances a holistic sensory experience.

Naturally, not everyone agrees with this new take that metal is taking, and comparisons to other bands with stronger sounds like Kilotron, Megatron, Tron, or even Yottazettapetatron quickly emerged, criticising the lame sound of Picotron and their surrender of values that were uncompromisable up until now.

Can you help the musical press express their comparisons more accurately in this acoustic tug-of-war?

Input

Input consists of several cases, each on its own line and made up of only lowercase letters, with the comparison a musical journalist wants to make, consisting of:

  • One or more band names, weighed by a numerical value between 1 and 999, and joined by the word “and”.

  • The band name they want to compare them to, preceded by the word “to”.

0.55 Following the trend set by Picotron, all heavy metal acts that are hot nowadays have a name consisting of zero or more SI prefixes with “tron” attached at the end. (Those metric prefixes are the ones standardised by the International System of Units, and are shown to the right.)

The number of bands in each comparison will be between 1 and 100. The number of prefixes in each name will be between 0 and 100.

0.45

Prefix Value Prefix Value
quetta 103010^{30} quecto 10−3010^{-30}
ronna 102710^{27} ronto 10−2710^{-27}
yotta 102410^{24} yocto 10−2410^{-24}
zetta 102110^{21} zepto 10−2110^{-21}
exa 101810^{18} atto 10−1810^{-18}
peta 101510^{15} femto 10−1510^{-15}
tera 101210^{12} pico 10−1210^{-12}
giga 10910^{9} nano 10−910^{-9}
mega 10610^{6} micro 10−610^{-6}
kilo 10310^{3} milli 10−310^{-3}

Output

For each case, express the value of the left part of the comparison as the number of times the target band it is equivalent to (assuming the prefixes directly correspond to musical quality).

Print the number without unnecessary leading or trailing zeros, and with a dot ‘.’ separating the integer and fractional parts. Don’t include a dot if it isn’t needed either.

Public test cases
  • Input

    1 kilotron to picotron
    1 kilotron to megatron
    1 kilotron and 1 megatron to picotron
    1 kilotron and 1 megatron and 5 picotron to picotron
    450 kilotron and 750 millimegatron to picoexatron
    450 kilotron and 750 millimegatron and 50 tron to picoexatron
    1 picotron to yottazettapetatron
    2 tron to tron
    

    Output

    1000000000000000
    0.001
    1001000000000000000
    1001000000000000005
    1.2
    1.20005
    0.000000000000000000000000000000000000000000000000000000000000000000000001
    2
    
  • Information
    Author
    Edgar Gonzalez
    Language
    English
    Official solutions
    C++
    User solutions
    C++