#C11199. Sort and Format Ingredients
Sort and Format Ingredients
Sort and Format Ingredients
You are given a list of ingredients along with their quantities. The task is to sort the ingredients in lexicographical (alphabetical) order by their names and format the result for delivery.
For each ingredient, output a line containing the ingredient's name followed by a space and its quantity. The implementation should read the input from standard input (stdin) and write the result to standard output (stdout).
Note: There is no formula in this problem.
inputFormat
The input is read from standard input (stdin) in the following format:
n ingredient1 quantity1 ingredient2 quantity2 ... ingredientn quantityn
Where n is an integer representing the number of ingredients, and each of the next n lines contains an ingredient name (a string) and its quantity (an integer), separated by space.
outputFormat
The output should be printed to standard output (stdout), with each line containing the ingredient name followed by a space and its corresponding quantity. The ingredients must be sorted in lexicographical order by their names.
## sample3
onion 5
carrot 2
lettuce 1
carrot 2
lettuce 1
onion 5
</p>