Lab SetsMaps - Sets and Maps
Solve the following two exercises in vpl.ccom.uprrp.edu
Exercise 1: Pokemon collection
This problem is easy to solve using a set.
Jack and Jill are friends and each has a collection of Pokemon cards. They are thinking of joining their collections and they don't like duplicates, so they would like to sell the cards they both have in common. For example, if Jack has Bulbasaur, Ivysaur and Venusaur, and Jill has Charmander, Venusaur, Kakuna, and Bulbasaur, then they can sell two cards (Bulbasaur and Venusaur).
They would like you to create a program that reads the lists of cards and then displays the number of cards that they can sell. The program will accept its input in the following format: first the number of Jack's cards followed by the names of his cards, then the number of Jill's cards followed by the names of her cards. For example:
3
Bulbasaur
Ivysaur
Venusaur
4
Charmander
Venusaur
Kakuna
Bulbasaur
Output format is just one integer: the number of cards that are both in Jill's and Jack's collections. In the example, the output would be: 2.
Pokemon name's list from: https://gist.github.com/azai91/31e3b31cbd3992a1cc679017f850a022
Exercise 2: Department of Security
The Parking Security Department of your university has a list of the misparked vehicles per day per parking lot: http://ccom.uprrp.edu/~rarce/ccom3034/policia.txt. Create a program that reads the information from the standard input and uses a map object to accumulate the number of misparked vehicles per parking lot. The output will be reported in alphabetical order of the parking lot, for example if the input is:
2018-11-01 educacion 10
2018-11-01 naturales 2
2018-11-02 naturales 7
2018-11-02 educacion 4
The output would be:
educacion 14
naturales 9