pseudocode Input : List of Items Group Items For each group, get the size of the corresponding list. Multiply the size by the amount of its key Sum the amount of each group to get the final amount Convert to standard currency