On Animal Farm, the animals have rebelled against their human owner and have taken over the management of the farm. To ensure equality and fairness among all the animals, they have decided to create a new set of rules. However, as the new leaders, the pigs have started making changes to the rules to favor themselves.
The farm maintains a hierarchy of animals based on their species, with each animal assigned a specific influence level. This influence level, represented as a positive integer, determines the animal's priority in decision-making. Within a group, an animal can make decisions if it has the highest influence level among the members.
The pigs have a plan to maximize their collective influence in the leadership council by selecting a specific group of animals. Given a list of animals with their species and influence levels, you are tasked to form the most influential leadership council while adhering to the following rules:
Determine the maximum total influence levels of the council that can be formed under these rules.
The first line contains an integer $$$n$$$, representing the number of animals. The next $$$n$$$ lines each contain a string species and a positive integer influence:
Technical Specification
Output a single integer, the maximum total influence levels of the leadership council that can be formed following the rules.
5 pig 10 horse 15 pig 5 cow 20 sheep 25
10
5 pig 10 horse 15 pig 15 cow 15 sheep 10
25
| Name |
|---|


