GO Solution For UVa 10009 - All Roads Lead Where?. In this post we will see how we can solve this challenge in GoLang for UVa Online Judge.

Problem Description

There is an ancient saying that “All Roads Lead to Rome”. If this were true, then there is a simple algorithm for finding a path between any two cities. To go from city A to city B, a traveller could take a road from A to Rome, then from Rome to B. Of course, a shorter route may exist.

The network

...

You can find the full details of the problem All Roads Lead Where? at UVa Online Judge

Sample Input

1

7 3
Rome Turin
Turin Venice
Turin Genoa
Rome Pisa
Pisa Florence
Venice Athens
Turin Milan
Turin Pisa
Milan Florence
Athens Genoa

Sample Output

TRP
MTRPF
AVTG

Solution: Please check the main.go snippet for the solution.

Solution originally posted at: Github by @codingsince1985