Programming contests

50 Programming Exercise for Beginners

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

Pizzas

Write a program that reads pizza data from a text file given as the first command line argument until the end of the file. Each line contains data for one pizza and is structured as follows:

pizza_name;ingredient[;ingredient]…;32cm_price;45cm_price

The pizza_name is a string of up to 32 characters, containing only English letters, digits, hyphens (minus signs), and space characters. An ingredient is a string of up to 32 characters, containing only English letters and space characters. The ingredients are followed by two positive integers: the 32cm_price shows the price of a pizza with a diameter of 32 cm, while the 45cm_price is the price of a pizza with a diameter of 45 cm. Two consecutive data in the line are separated by a semicolon character.

The program should determine and write to the first line of the standard output the number of ingredients of the pizza(s) with the most ingredients. In the following lines, the names of these pizzas should be written in the order of their occurrence in the text file, one by line.

Sample Input

  1. margareta;paradicsom;mozzarella;840;1640
  2. szalamis;szalami;mozzarella;940;1900
  3. sonkas-gombas;sonka;gomba;mozzarella;1040;2100
download as text file

Output for Sample Input

  1. 3
  2. sonkas-gombas
download as text file
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. 09/30/2024