#C7156. Total Enhancements

    ID: 50996 Type: Default 1000ms 256MiB

Total Enhancements

Total Enhancements

You are given a set of items that enhance a character's attributes in three categories: Health, Attack, and Defense. Each item is represented by a character and a numerical value. The character can be:

  • H: Health
  • A: Attack
  • D: Defense

Your task is to compute the total enhancements for each of these three categories.

For example, if you receive the following 5 items:

H 20
A 15
D 10
H 30
A 25

Then the total enhancements are computed as follows:

  • Health: \(20 + 30 = 50\)
  • Attack: \(15 + 25 = 40\)
  • Defense: \(10 = 10\)

Thus, the output should be 50 40 10.

inputFormat

The first line contains an integer (n), representing the number of items. Each of the next (n) lines contains a character and an integer separated by a space. The character is one of 'H', 'A', or 'D', indicating the type of enhancement, and the integer represents the amount.

outputFormat

Output three integers separated by a single space, representing the total enhancements for Health, Attack, and Defense respectively.## sample

5
H 20
A 15
D 10
H 30
A 25
50 40 10