# how to solve passenger counters in an airport?

Air India Express is flying from Calicut to Mumbai today. n passengers have reported in each counter C_1, C_2, C_3 from 9.00 to 10.30 AM. You are given the Boarding pass number B_no (string) and reporting time R_time (float) of passengers of the three counters as separate lists. The details are given in the nondecreasing order of their R_time. Passengers are to be grouped according to their R_time. All the passengers having the same R_time are to be in the same group (a group can contain either one or more passengers). The groups are numbered 1, 2, 3, . . . m as per the non-decreasing order of R_time (Group 1 consisting of passengers who arrived first). Using the concept of merge, print the details of passengers in group 1 to k. Your program should implement the following functions as per the function prototypes: • main() - Repeatedly read a character from {r, d, p, g, t} and call the sub-functions appropriately until character t is encountered. • read_details(C, n) : Read the Boarding pass number B_no and reporting time R_time of n passengers reported at counter C and store it in the array C. • display_details(C, n) : For each passenger in the array C of length n, print the B_no and R_time (separated by a space), in a new line. • peak_time(C, n) : Find and print the R_time at which most number of passengers in the array C of length n have reported. If same number of passengers have reported at two different R_time, consider the earlier time. • group_g(C_1, C_2, C_3, n, k) : – Merge the arrays C_1, C_2 and C_3, each of size n to a combined sorted array(if the R_time of any two passengers are same, then their relative order should be preserved as in the input ) – if no passengers exist in k th group, return -1. – Otherwise, using the function display_details(), print the details of passengers in group 1 to k, and return the R_time of the passenger/s in the group k. Input/Output Format The input consists of multiple lines. Each line may contain a character from {r, d, p, g, t} followed by zero or more integers. • The first line contains an integer n, the number of passengers in each counter. • Character r: Character r is followed by an integer from {1, 2, 3} – If character r is followed by 1, the next n lines contain B_no and R_time of the n passengers of counter C_1, separated by a space. – If character r is followed by 2, the next n lines contain B_no and R_time of the n passengers of counter C_2, separated by a space. – If character r is followed by 3, the next n lines contain B_no and R_time of the n passengers of counter C_3, separated by a space. • Character p: Character p is followed by an integer from {1, 2, 3} – If character p is followed by 1, print the R_time at which most of the passengers in the counter C_1 have reported. – If character p is followed by 2, print the R_time at which most of the passengers in the counter C_2 have reported. – If character p is followed by 3, print the R_time at which most of the passengers in the counter C_3 have reported. • Character g: Character g is followed by an integer corresponding to the group number k. – Call function group_k(C_1, C_2, C_3, n, k) (Note that group_k prints the details of passengers in group 1 to k.) – Print the R_time of the passenger/s in group k. • Character d: Character d is followed by an integer from {1, 2, 3}. – If character d is followed by 1, print the details of passengers who reported at counter C_1. – If character d is followed by 2, print the details of passengers who reported at counter C_2. – If character d is followed by 3, print the details of passengers who reported at counter C_3. • Character t: Terminate the program. Input 3 r 1 AIR001 9.10 AIR023 9.20 AIR090 10.10 r 2 AIR022 9.20 AIR098 10.00 AIR100 10.00 r 3 AIR078 9.45 AIR670 10.00 AIR232 10.10 g 4 d 2 p 2 t Output AIR001 9.10 AIR023 9.20 AIR022 9.20 AIR078 9.45 AIR098 10.00 AIR100 10.00 AIR670 10.00 10.00 AIR022 9.20 AIR098 10.00 AIR100 10.00 10.00