legendary farming
моля за малко помощ при кода. Ако не е във while ми дава unreachable code, ако е вътре не работи както трябва.
това е условието
3. Legendary Farming
You’ve done all the work and the last thing left to accomplish is to own a legendary item. However, it’s a tedious
process and it requires quite a bit of farming. Anyway, you are not too pretentious - any legendary item will do. The
possible items are:
Shadowmourne - requires 250 Shards;
Valanyr - requires 250 Fragments;
Dragonwrath - requires 250 Motes;
Shards, Fragments and Motes are the key materials and everything else is junk. You will be given lines of input, in
the format:
2 motes 3 ores 15 stones
Keep track of the key materials - the first one that reaches the 250 mark, wins the race. At that point you have to
print that the corresponding legendary item is obtained. Then, print the remaining shards, fragments, motes,
ordered by quantity in descending order, then by name in ascending order, each on a new line. Finally, print the
collected junk items in alphabetical order.
Input
Each line comes in the following format: {quantity} {material} {quantity} {material} … {quantity} {material}
Output
On the first line, print the obtained item in the format: {Legendary item} obtained!
On the next three lines, print the remaining key materials in descending order by quantity
o If two key materials have the same quantity, print them in alphabetical order
On the final several lines, print the junk items in alphabetical order
o All materials are printed in format {material}: {quantity}
o The output should be lowercase, except for the first letter of the legendary