37126ABCD

Distance Matrix:

ABCD
A037
B01
C02
D60

Pseudocode:

            for k from 0 to n-1:
              for i from 0 to n-1:
                for j from 0 to n-1:
                  if dist[i][k] + dist[k][j] <
              dist[i][j]:
                    dist[i][j] =
              dist[i][k] + dist[k][j]
          

Explanation

Algorithm initialized. Starting with initial distance matrix.