Problem Statement | |||||||||||||
You are in charge of writing some software to generate an itemized invoice. You have a raw list of items that were purchased, but the raw list is not very user friendly. Your code should determine how many of each item were purchased, and return a list of items and their quantity. You are given a String[] items, each element representing a single item. You must return a String[] listing, in alphabetical order, each item and its quantity. Each element of the return should be formatted as "item - quantity" (quotes added for clarity), where the quantity has no leading zeroes. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | items will contain between 1 and 50 elements, inclusive. | ||||||||||||
- | Each element of items will contain between 1 and 50 lowercase letters ('a'-'z'), inclusive. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
|