8. A Miner Task
Здравейте!
Някой може ли да помогне?
8.A Miner Task
You are given an array of strings. Every odd string is representing a resource (e.g. Gold, Silver, Copper, and so on), and every even – quantity. Your task is to collect the resources and print them each on a new line.
Print the resources and their quantities in the format:
{resource} –> {quantity}
The quantities inputs will be in the range [1 … 2 000 000 000]
Examples
Input |
Output |
|
Input |
Output |
[ 'Gold', '155', 'Silver', '10', 'Copper', '17' ] |
Gold -> 155 Silver -> 10 Copper -> 17 |
|
[ 'gold', '155', 'silver', '10', 'copper', '17', 'gold', '15' ] |
gold -> 170 silver -> 10 copper -> 17 |
Моето решение:
https://pastebin.com/eAh6Y1GZ
Не разбитам защо ги конкатенира.
Благодаря! :)