#C11654. Recipe Classification
Recipe Classification
Recipe Classification
You are given an integer n
which represents the number of recipes, followed by n
recipes. Each recipe is presented in the format <recipe_id>:<ingredient1>,<ingredient2>,...
. Your task is to classify each recipe into one of the following categories based on its ingredients:
- Appetizer: { lettuce, tomato, cucumber, olive, cheese, vinaigrette }
- Main Course: { chicken, beef, pork, rice, potato, carrot }
- Dessert: { chocolate, sugar, milk, flour, butter, egg }
For each recipe, if the number of ingredients belonging to one of these categories is at least half of the total number of ingredients in the recipe, then the recipe is classified as that category. If none of the categories meet this requirement, classify the recipe as "Unknown". Note that if a recipe meets the condition for a category, check the categories in the order: Appetizer, Main Course, Dessert, and assign the first matching category.
Output the classification in the format <recipe_id>:<Category>
for each recipe.
inputFormat
The first line of input contains an integer n
, representing the number of recipes. Each of the next n
lines contains a recipe in the format <recipe_id>:<ingredient1>,<ingredient2>,...
.
outputFormat
Output n
lines. Each line should contain the classification of a recipe in the format <recipe_id>:<Category>
.
1
1:lettuce,tomato,olive,cheese
1:Appetizer
</p>