|
|||
LEGO
You probably remember one of the favorite games of your childhood, the colored building blocks. Recently, Bob has found all of his old blocks in the attic, so he thought it was time to build some cool stuff. He would like to build as many sets as possible that he didn't buy earlier but still can build using his own blocks. He started to make notes on how many blocks of different types and colors he found. Unfortunately, he found the blocks scattered in various parts of the attic, so sometimes he made multiple items in his notes about blocks of the same type and color. Write a program that helps him summarize the number of his blocks of different types and colors and decides whether a chosen set can be built or not. Input SpecificationThe input consists of two parts. The first part contains the blocks needed to build the chosen set. The second part lists the blocks Bob found in the attic and lasts till end-of-file. The first part is separated from the second part by a blank line. All lines of the input (except the blank line) are of the form type color count, where type is a unique identifier of a block type (positive integer), color is a spaceless string containing the color of the block, and count is either the number of blocks needed to build the chosen set or the number of blocks that were found by Bob in the attic. You may assume that no lines of the input contains more than 30 characters. Output Specification
The first line of the output should contain either the string “ Sample Input 1
Output for Sample Input 1
Sample Input 2
Output for Sample Input 2
|
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |