Programming contests

50 Programming Exercise for Beginners

January 2, 2019 12:00 AM – December 31, 2019 12:00 AM

Zoo

Write a program that reads zoo data from the standard input until end-of-file. Each line contains data for one zoo and is structured as follows:

zoo_city;animal_species[;animal_species]…;foundation_year;number_of_visitors

The zoo_city is a string of up to 40 characters, containing only English letters, hyphens (minus signs), and space characters. An animal_species is a string of up to 32 characters, containing only English letters, hyphens (minus signs), and space characters. The animal species are followed by two positive integers: the foundation_year represents the foundation year of the zoo, while the number_of_visitors indicates how many visitors visited the zoo during the past year. Two consecutive data in the line are separated by a semicolon character.

The program should determine and write to the standard output the city of the zoo that hosts the most animal species. If there are multiple zoos with the same maximum number of species, then output the city of the most recent one.

Sample Input

Output for Sample Input

  1. Veszprem
download as text file

One possible solution is available in: main.c.

Acknowledgement This work was supported by the construction EFOP-3.4.3-16-2016-00021. The project was supported by the European Union, co-financed by the European Social Fund.
University of Debrecen; Faculty of Informatics; v. 03/01/2019