#K3996. Categorize Culinary Recipe
Categorize Culinary Recipe
Categorize Culinary Recipe
You are given a recipe description containing multiple lines. The first line is the recipe identifier, the second line is the recipe title, and every subsequent line is an ingredient description. Your task is to categorize the recipe based on the ingredients provided.
The categorization is defined as follows:
- If the ingredients contain the substring \(tomato\) (case insensitive), print 1.
- If not, and they contain \(cheese\) (case insensitive), print 2.
- If neither of the above holds and they contain \(chocolate\) (case insensitive), print 3.
- If none of these ingredients is found, print 0.
Read the input from STDIN until EOF and output your result to STDOUT.
inputFormat
The input consists of multiple lines provided via STDIN:
- The first line is a recipe identifier (a string).
- The second line is the recipe title.
- The subsequent lines each describe an ingredient in the recipe.
You are required to read until the end of input (EOF).
outputFormat
Output a single integer to STDOUT which indicates the category of the recipe:
- Output 1 if the ingredients contain the substring tomato.
- Otherwise, output 2 if the ingredients contain cheese.
- Otherwise, output 3 if the ingredients contain chocolate.
- If none of these substrings is present, output 0.
100
Summer Salad
2 large tomatoes
1 cucumber
1 red onion
2 tablespoons olive oil
Salt and pepper to taste
1