#K60167. Count Food Stall Types
Count Food Stall Types
Count Food Stall Types
You are given the number of food stalls and a list of strings representing the type of each stall. Each stall is of one of the following three types: Vegetarian
, Non-Vegetarian
, or Mixed
.
Your task is to count how many stalls are of each type and output the counts in the order: vegetarian, non-vegetarian, and mixed.
The problem can be mathematically interpreted as counting occurrences in a sequence. Let \( S = [s_1, s_2, \ldots, s_n] \) be the list of stall types, then you need to compute:
- \( \text{vegetarian} = \#\{ i \mid s_i = \text{'Vegetarian'} \} \)
- \( \text{non-vegetarian} = \#\{ i \mid s_i = \text{'Non-Vegetarian'} \} \)
- \( \text{mixed} = \#\{ i \mid s_i = \text{'Mixed'} \} \)
Print the three counts separated by spaces.
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains an integer
n
which represents the number of food stalls. - The second line contains
n
strings separated by spaces. Each string is one ofVegetarian
,Non-Vegetarian
, orMixed
.
outputFormat
Output three space separated integers to standard output (stdout) representing the count of Vegetarian
, Non-Vegetarian
, and Mixed
stalls, respectively.
5
Vegetarian Non-Vegetarian Mixed Vegetarian Mixed
2 1 2