#C9609. Minimum Cages for Animal Enclosures
Minimum Cages for Animal Enclosures
Minimum Cages for Animal Enclosures
You are given a list of animal species along with their respective counts. Each cage can house animals of only one species. Since each species must be kept in a separate cage, the minimum number of cages required is simply equal to the number of different species provided in the input.
Note: The input list will only contain distinct species.
For example, if the input is:
3 lion 3 tiger 2 elephant 1
Then, the output is 3 because there are three different species.
This can be mathematically represented as: \[ \text{min\_cages} = N, \] where \(N\) is the number of species.
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains an integer \(N\) (\(0 \leq N \leq 10^5\)), denoting the number of species.
- The following \(N\) lines each contain a species name (a string without spaces) and an integer representing the number of animals of that species, separated by a space.
If \(N = 0\), there will be no additional lines.
outputFormat
Output a single integer to standard output (stdout) representing the minimum number of cages required.
## sample3
lion 3
tiger 2
elephant 1
3