Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Jojo usually commutes to work by boarding a train at Bee Noose station. Recently, the time table format at Bee Noose station was changed. The

Jojo usually commutes to work by boarding a train at Bee Noose station. Recently, the

time table format at Bee Noose station was changed. The new format is giving Jojo

trouble.

The time table at Bee Noose station consists of two parts. The first part contains the ID

of each train and the departure time at which the corresponding train will depart. The

second part of the time table tells Jojo the destination and origin of each train.

Unfortunately, while the first part of the time table is sorted by departure time, the

order of the second part is completely disorganized. Help Jojo figure out which route he

needs to take by combining both parts of the time table into a single complete time table.

Format Input

The first line contains a single integer N, the number of routes at Bee Noose station. 2N

lines will follow.

The next N lines will contain two strings IDi and Ti

. This is the first part of the time

table, which tells Jojo that the train with ID IDi will depart at Ti

.

The next N lines will contain three strings IDi

, Oi

, and Di

. This is the second part of

the time table, which tells Jojo that the train with ID IDi

is a train gonig from Oi to Di

.

Format Output

Output a complete time table - the first part of the time table with the origins and

destinations added besides the departure times.

Constraints

1 N 1000

1 |IDi

| 20

1 |Oi

|, |Di

| 100

00:00 Ti 23:59

The input will only contain alphanumeric characters and the colon symbol (:).

Sample Input (standard input)

6

TR000 07:00

TR001 09:00

TR002 11:00

TR003 13:00

TR004 15:00

TR005 17:00

TR003 ASO ALSUT

TR002 ALSUT ASO

TR000 ANGGREK BEKASI

TR004 BEKASI ANGGREK

TR001 ALSUT ANGGREK

TR005 ANGREK ALSUT

Sample Output (standard output)

TR000 07:00 ANGGREK BEKASI

TR001 09:00 ALSUT ANGGREK

TR002 11:00 ALSUT ASO

TR003 13:00 ASO ALSUT

TR004 15:00 BEKASI ANGGREK

TR005 17:00 ANGREK ALSUT

Note : Use C Language & stdio.h and string.h

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students also viewed these Databases questions