#C5100. Hospital Appointment Manager

    ID: 48713 Type: Default 1000ms 256MiB

Hospital Appointment Manager

Hospital Appointment Manager

You are required to design a program to manage a hospital's appointment system. The program must read a list of appointments from standard input and then output a sorted schedule for each doctor.

Each appointment is given on a separate line in the format:

\( \texttt{patient_name\ appointment_time\ doctor_name} \)

The input terminates with a line containing only END. For each doctor, the program should output the doctor’s name followed by a colon on one line, and then each appointment for that doctor on a new line in the format:

\( \texttt{patient_name\ at\ appointment_time} \)

The appointments for each doctor must be sorted in ascending order by the appointment time, and the doctors themselves should be listed in lexicographical order.

If there are no appointments (i.e. the first line is END), the program should output nothing.

inputFormat

The input is read from standard input (stdin) and consists of multiple lines. Each line (except the last) contains an appointment in the format patient_name appointment_time doctor_name. The final line of input is END which signifies the end of input.

The appointment time is given in 24-hour format \( HH:MM \).

outputFormat

The output is written to standard output (stdout). For each doctor with at least one appointment, first print the doctor's name followed by a colon (doctor_name:) on a separate line. Then for each appointment of that doctor, print a line in the format patient_name at appointment_time, with the appointments sorted by time in ascending order.

Doctors should be printed in lexicographical order. If there are no appointments, no output should be produced.

## sample
John 10:30 DrSmith
Jane 09:45 DrSmith
Alice 13:00 DrJones
Bob 15:30 DrSmith
Charlie 12:15 DrJones
END
DrJones:

Charlie at 12:15 Alice at 13:00 DrSmith: Jane at 09:45 John at 10:30 Bob at 15:30

</p>