#C4043. Toll Transaction Summary Report
Toll Transaction Summary Report
Toll Transaction Summary Report
You are given a series of toll transactions. Your task is to generate a summary report that shows the number of vehicles and the total toll collected for each vehicle type.
Specifically, the input starts with an integer (n), representing the number of transactions. This is followed by (n) lines where each line contains a vehicle type and a toll amount separated by a space. The vehicle type will be one of the following: car, truck, or motorcycle.
The output should display three lines: one for Cars, one for Trucks, and one for Motorcycles. Each line must follow the format:
(\text{Type}: [\text{count}, \text{total toll}]).
inputFormat
The first line of the input contains an integer (n) that represents the number of toll transactions. The next (n) lines contain a transaction each, where each transaction is formatted as a string and an integer separated by a space. The string represents the vehicle type (either car, truck, or motorcycle) and the integer represents the toll amount.
outputFormat
The program should output exactly three lines. The first line displays the summary for Cars, the second line for Trucks, and the third line for Motorcycles. Each output line should follow this format:
(\text{Type}: [\text{number of vehicles}, \text{total toll collected}]).## sample
6
car 50
truck 100
car 50
motorcycle 20
car 50
truck 100
Cars: [3, 150]
Trucks: [2, 200]
Motorcycles: [1, 20]
</p>