#C6652. Sort Inventory Items
Sort Inventory Items
Sort Inventory Items
You are given an inventory list containing N items. Each item consists of a product name and a quantity. Your task is to sort the inventory items in alphabetical order based on their product names in a case-insensitive manner.
The sorting should consider the lowercase form of the product names such that, for example, "apple" and "Apple" are compared equally.
Note: The input is read from standard input (stdin) and the output should be written to standard output (stdout). The order should be maintained strictly in sorted order as defined by the case-insensitive comparison.
In mathematical terms, if we denote the product name of an item by \(s\), then the correct sorted order is determined by the ordering of \(\text{lower}(s)\) for each string \(s\).
inputFormat
The first line of input contains an integer N
representing the number of inventory items. This is followed by N
lines, each containing a product name (a string without spaces) and an integer representing its quantity, separated by a space.
outputFormat
Output the sorted inventory list with each item printed on a new line. Each line should contain the original product name and quantity separated by a space. The sorting is done in case-insensitive alphabetical order based on the product name.
## sample5
Banana 50
apple 30
Orange 40
grape 60
Peach 20
apple 30
Banana 50
grape 60
Orange 40
Peach 20
</p>