#K32997. Filter Records by Decade
Filter Records by Decade
Filter Records by Decade
You are given a list of records and a list of decades. Each record is represented as a tuple containing the title of the record and the decade it was released. Your task is to filter the records that fall into any of the decades of interest.
If one or more records match, print their titles each on a separate line. Otherwise, print No records found
.
For instance, given records such as "Dark Side of the Moon" (1970), "Thriller" (1980), and others, if the decades of interest are \(1970\) and \(1980\), then only records from those decades should be output.
inputFormat
The input is read from stdin in the following format:
- The first line contains an integer n representing the number of records.
- The next n lines each contain a record in the format:
title,decade
. The title is a string (without commas) and decade is an integer. - The following line contains an integer m representing the number of decades of interest.
- If m is greater than 0, the next line contains m space-separated integers representing the decades.
outputFormat
Output the titles of the records that match the decades of interest to stdout. Print each title on a new line. If no records match, output No records found
.
6
Dark Side of the Moon,1970
Thriller,1980
Nevermind,1990
Abbey Road,1960
Back in Black,1980
The Wall,1970
2
1970 1980
Dark Side of the Moon
Thriller
Back in Black
The Wall
</p>