A dockyard scanner records shipping containers as they roll past on the conveyor, one at a time. Each scan produces a container ID and the container's weight in kilograms. You must assemble these raw scans into a manifest table for the shipping log: a header row naming the two columns, followed by one row per scanned container, kept in the exact order the containers were scanned (do not sort or reorder them).
The first line contains a single integer n, the number of scanned containers.
Each of the next n lines contains two integers container_id and weight_kg, separated by a space.
Print n + 1 lines. The first line is exactly the header container_id,weight_kg. Each following line corresponds to one scanned container, in the same order it appears in the input, formatted as <container_id>,<weight_kg> (no spaces, comma-separated). If n is 0, print only the header line.
0 <= n <= 10001 <= container_id <= 10000000000 <= weight_kg <= 1000000Example 1
Input
3 101 25 102 30 103 22
Expected
container_id,weight_kg 101,25 102,30 103,22
Explanation
Three containers were scanned in this order: (101,25), (102,30), (103,22). The manifest keeps that exact order, printing the header first, then each row as 'id,weight'.
Example 2
Input
0
Expected
container_id,weight_kg
Explanation
No containers were scanned, so the manifest consists of only the header line 'container_id,weight_kg' with no data rows.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →