#K81352. Song Filtering Function

    ID: 35734 Type: Default 1000ms 256MiB

Song Filtering Function

Song Filtering Function

Given a list of songs and search criteria, filter the songs that satisfy all criteria. The criteria may include (\texttt{genre}), (\texttt{min_popularity}) (as a minimum popularity threshold), and (\texttt{year}). Read the input in JSON format from standard input and output a JSON array of the song titles that match all the specified conditions. Please note that if the criteria object is empty, all songs should be returned.

inputFormat

The input consists of two lines read from standard input. The first line is a JSON array of song objects. Each song object contains the following keys: (\texttt{title}) (a string), (\texttt{genre}) (a string), (\texttt{popularity}) (an integer), and (\texttt{year}) (an integer). The second line is a JSON object representing the filtering criteria. The criteria object may contain one or more of these keys: (\texttt{genre}), (\texttt{min_popularity}), and (\texttt{year}).

outputFormat

Output a single line containing a JSON array of strings which are the titles of the songs that match all the filtering conditions.## sample

[{"title": "Song1", "genre": "Rock", "popularity": 90, "year": 2000}, {"title": "Song2", "genre": "Pop", "popularity": 80, "year": 2005}, {"title": "Song3", "genre": "Rock", "popularity": 85, "year": 2010}]
{"genre": "Rock"}
["Song1","Song3"]