Revenue by section
Your task
A store's sales feed tags each line with a slash-separated catalog path. Each row is "path,amount" where path looks like "electronics/phones/cases" and amount is a positive integer; a path may also be a single segment like "toys". For the executive summary, total the amounts per TOP-LEVEL section (the first path segment). Example: ["electronics/phones,200", "electronics/laptops,300", "home/kitchen,50"] gives {"electronics": 500, "home": 50}.
Examples
top_level_totals(rows: list[str]) -> dict[str,int]Example 1
Input
top_level_totals(["electronics/phones,200", "electronics/laptops,300", "home/kitchen,50"])Output
{"electronics": 500, "home": 50}