Mr. Harrison is planning a road trip through California. Luckily he has found a single road that connects the 5 cities he would like to visit.
The 5 cities (labelled A to E) that he will visit are as follows:
- A. San Diego - (Start)
- B. Los Angeles
- C. San Jose
- D. San Francisco
- E. Sacramento - (Finish)
When using the road, the distance from A (San Diego) to B (Los Angeles) is 205 km. The distance from B to C is 547 km. C to D is 78 km. Finally, the distance from D to E is 141 km.
Mr Harrison would like a way of quickly checking the distance between any 2 cities he will visit on his trip, he refuses to travel on any other road.
Write a program that will calculate and output a table showing the distance between all of the cities.
For example, your output may look something like this:
| A B C D E
---------------------------------
A | 0km 205km 752km 830km 971km
B | 205km 0km 547km 625km 776km
C | 752km 547km 0km 78km 219km
D | 830km 625km 78km 0km 141km
E | 971km 776km 219km 141km 0km
Bonus points are available for the formatting of your output, if all rows and columns are aligned perfectly (like in the example) then you will receive the bonus points for this round.