The end of course is near! In a nursery, the educators have collected information about the toys that each girl and each boy like. To do it, the educators ask the children which is the toy they want to play with, and write down in a list the name of the boy/girl and the chosen toy.
The educators have asked you to write a program that counts the number of appearances of each pair child/toy.
The input starts with a natural number . Afterwards, there is a list with the pairs of child’s name/toy. The names of the children are formed only by lowercase letters and digits.
For each pair child/toy, print a line indicating how many times appears this pair. The list must be sorted by the name of the child, using the name of the toy as second criterion. Follow the format of the instances.
Some input lists can be very large. For this reason, your program must be efficient. We suggest you to use the function |sort()| to sort tuples (|struct|s).
Author: Unknown
Translator: Carlos Molina
Generation: 2026-01-25T10:24:29.062Z
© Jutge.org, 2006–2026.
https://jutge.org