Practical HackerRank exercise: parse text input and aggregate it (e.g., aggregating transactions from a CSV).
Asked in the tech screen stage.
Implement parse_and_aggregate(csv_text). The input is a CSV string with a header category,amount and one transaction per subsequent row. Return a dictionary mapping each category to the sum of its amounts. Categories may contain quoted commas, and repeated categories must be combined. Ignore empty lines. Amounts are integers.
category,amount.def parse_and_aggregate(csv_text):