#C3810. Count Items by Category
Count Items by Category
Count Items by Category
You are given a list of items sold, each in the format ItemName,Category
. The Category can only be one of the following three: Electronics, Clothing, or Groceries. Your task is to count how many items were sold in each valid category. If an item belongs to any other category, ignore it.
The input begins with an integer \( n \) which denotes the number of item records. Each of the next \( n \) lines contains an item record. The output should be three integers representing the counts of Electronics, Clothing, and Groceries respectively, printed in a single line separated by spaces.
inputFormat
The first line of input contains a single integer \( n \) (0 \( \leq n \leq 10^5 \)), the number of items. Each of the following \( n \) lines contains a string in the format ItemName,Category
.
outputFormat
Output a single line with three space-separated integers: the counts of items in the categories Electronics, Clothing, and Groceries, in that order.
## sample9
Laptop,Electronics
Shirt,Clothing
Milk,Groceries
Phone,Electronics
Pants,Clothing
Bread,Groceries
TV,Electronics
Jacket,Clothing
Cheese,Groceries
3 3 3
</p>