You are given a stack of boarding cards for various transportation types that will take you from a point A to point B via several stops on the way. All of the boarding cards are out of order and you don't know where your journey starts, nor where it ends. Each boarding card contains information about seat assignment, and means of transportation (such as flight number, bus number etc).
Write an API that lets you sort this kind of list and present back a description of how to complete your journey.
For instance the API should be able to take an unordered set of boarding cards, provided in a format defined by you, and produce this list:
- Take train 78A from Madrid to Barcelona. Sit in seat 45B.
- Take the airport bus from Barcelona to Gerona Airport. No seat assignment.