#C399. Most Reviewed Product
Most Reviewed Product
Most Reviewed Product
You are given a list of product reviews. Each review contains a product identifier, a review date, and a review comment. Your task is to determine the product that has received the highest number of reviews within a specified date range. The date format is given as \(YYYY-MM-DD\), and you should only consider reviews that satisfy \(start\_date \le review\_date \le end\_date\).
If multiple products have the same highest review count, output the product with the lexicographically smallest identifier. If there are no reviews within the date range, output an empty string.
Note: The input is read from stdin
and the result should be printed to stdout
.
inputFormat
The input consists of several lines. The first line contains an integer \(N\) representing the number of reviews. For each review, the next three lines are provided in order:
- Product identifier (a string).
- Review date in the format \(YYYY-MM-DD\).
- Review comment (a string that may contain spaces).
After the reviews, there are two additional lines:
- Start date (\(YYYY-MM-DD\)).
- End date (\(YYYY-MM-DD\)).
outputFormat
Output a single line containing the product identifier that has the maximum number of reviews within the given date range. If there are multiple such products, output the one with the lexicographically smallest identifier. If no review falls within the date range, output an empty string.
## sample1
product1
2023-01-01
Good product
2023-01-01
2023-01-01
product1