06.Vehicle Catalogue - Objects and Classes Exercise - 33/100

Здравейте, 

По някаква причина Judge ми дава 33/100 на задачата, като пробните тестовете минават. Не мисля, логиката е грешна, нито пък кода. Не намирам грешката и ще съм благодарен за насоки.

Това е кода: https://pastebin.com/CBteAP2e

Условието + Линк към Judge:

Judge: https://judge.softuni.bg/Contests/Compete/Index/1327#5

Vehicle Catalogue

You have to make a catalog for vehicles. You will receive two types of vehicles - car or truck.

Until you receive the command "End" you will receive lines of input in the format:

{typeOfVehicle} {model} {color} {horsepower}

After the "End" command, you will start receiving models of vehicles. Print for every received vehicle its data in the format:

Type: {typeOfVehicle}

Model: {modelOfVehicle}

Color: {colorOfVehicle}

Horsepower: {horsepowerOfVehicle}

 

When you receive the command "Close the Catalogue", stop receiving input and print the average horsepower for the cars and for the trucks in the format:

"{typeOfVehicles} have average horsepower of {averageHorsepower}."

The average horsepower is calculated by dividing the sum of horsepower for all vehicles of the type by the total count of vehicles from the same type.

Format the answer to the 2nd decimal point.

Constraints

  • The type of vehicle will always be car or truck
  • You will not receive the same model twice
  • The received horsepower will be integer in the interval [1…1000]
  • You will receive at most 50 vehicles
  • Single whitespace will be used for separator

Examples

Input

Output

truck Man red 200

truck Mercedes blue 300

car Ford green 120

car Ferrari red 550

car Lamborghini orange 570

End

Ferrari

Ford

Man

Close the Catalogue

Type: Car

Model: Ferrari

Color: red

Horsepower: 550

Type: Car

Model: Ford

Color: green

Horsepower: 120

Type: Truck

Model: Man

Color: red

Horsepower: 200

Cars have average horsepower of: 413.33.

Trucks have average horsepower of: 250.00.