Program

Write a program to convert a cryptocurrency code back to a secret passcode. The cryptocurrency code was generated using CryptoCurrency Code Algorithm that involves dollars, quarters, dimes, nickels, and pennies.

Input

  • The input crypto current code.

Output 

  • The un-encrypted secret passcode.

Algorithm

  • Parse an extract the amounts of currency denominations (dollars, quarters, dimes, nickels, and pennies).
  • For each denomination where the amount was > 0, a two letter prefix was used to encrypt that currency denomination.
  • Convert the amounts for each denomination into cents to get back the secret passcode.
    Dollardo
    Quaterqu
    Dimedi
    Nickelni
    Pennype

Test cases

NoInput (CryptoCurrency Code)Intermediate CalculationOutput (Secret Passcode)
12do1qu2di3pe
2 dollars, 1 quarter, 2 dimes, 3 pennies248
22do1qu2di
2 dollars, 1 quarter, 2 dimes
245
32do2qu1ni2pe
2 dollars, 2 quarters, 1 nickel, 2 pennies
257
42qu1pe
2 quarters, 1 penny
51
51ni1pe
1 nickel, 1 penny
6
61ni
1 nickel
5
71do
1 dollar
100

Instructions 

  • Accept the input number cryptocurrency code via the command line.
  • Write the logic to compute a number of currency denominations (dollars, quarters, dimes, nickels, and pennies) and convert each to a cents value and add up.
  • Display the resulting secret passcode.