Count employees by department
Your task
An HR export lists one employee per row as a comma-delimited string "name,dept", for example "ava,eng". Write a function that returns a dictionary mapping each department name to the number of employees in it. For example, ["ava,eng", "raj,sales", "mia,eng"] gives {"eng": 2, "sales": 1}.
Examples
dept_headcount(rows: list[str]) -> dict[str,int]Example 1
Input
dept_headcount(["ava,eng", "raj,sales", "mia,eng"])Output
{"eng": 2, "sales": 1}