On 12 June 1942, Anne received a diary as a gift. She started writing on it. Later, her diary had become a part of history as it is considered an important document of World War II.
In order to make Anne’s work available online, you will have to write a program that will answer some queries. Initially, you will be given the list of days when Anne wrote on her diary. Based on this given list, you will have to answer some queries. In each query, you will be given two dates and you will have to answer how many days Anne had written in her diary between these two given dates.
The first line of the input will contain an integer (), the total number of days Anne had written in her diary. In the next lines, there will be a day in the format:
Month Day, Year
The values of the Month will be from January, February, March, April, May, June, July, August, September, October, November and December.
The next line will contain an integer (), the total number of queries.
Each query will have two valid dates each on a line by itself. The first date will be earlier or equal to the second date.
The value of all the dates can be any valid date from June 12, 1942 to December 31, 1944.
For each query, output one line, the number of days Anne has written in her diary within the given two dates.
2 June 12, 1942 June 21, 1942 1 June 15, 1942 June 22, 1942
Login to submit
First, the dates when Anne had written in her diary can be sorted, although it is not necessary with...