UVa 11532 - Simple Adjacency Maximization

Summary
Reconstruct a number given the set of rules. This can be done with a greedy algorithm.

Input
100 27 15 12 27 40 9 13 26 11 18 17 29 12 23 29 2 22 8 19 17 43 6 21 19 15 20 13 26 6 23 12 20 5 25 36 5 13 7 14 17 34 14 43 0 37 8 3 1 32 10 26 18 17 1 47 2 2 6 1 30 31 17 9 27 17 6 47 3 6 33 19 24 28 21 3 19 20 18 8 15 46 1 21 5 14 28 41 0 43 0 34 14 24 14 37 6 27 15 9 36 32 1 25 7 24 21 18 28 26 4 6 40 4 18 19 17 22 25 5 39 4 36 5 4 22 28 11 10 5 1 11 30 28 5 22 15 8 16 32 8 12 24 0 36 29 0 18 21 10 13 9 23 13 18 26 16 36 7 29 18 37 12 9 9 36 10 6 1 13 22 21 5 21 4 39 11 5 28 27 0 34 8 20 24 22 19 22 0 9 31 32 5 44 4 29 19 23 26 0 5

Output
942438538093 187245 402107110785023 449389 56173 28760941 187245 1543503871 766958463 230087533 402107723153407 1840700269 3595117 449389 365 187245 109 1570750070783 449389 1497965 201053554793343 8796093022207 25131694948351 11 3141461794815 392682724205 196607 404620279021567 5 1 60316066437997 7021 5991871 804842511532031 365 230087533 3141461793645 13 766958445 2925 105553116266495 47935487 1497965 2199023255551 8796093022207 201053554793343 49085340525 6282933174271 942438538093 7021 6442450943 3067834367 49085340525 95869805 767033343 365 45 230087533 6135667565 109 45 109 6135667565 56173 47 56173 6135742463 6135667565 2925 785365467135 187245 0 536870911 95869805 23405 7021 449389 392682724205 6282924785663 7539508304749 402107109588991 7021 50263388717055 95 449389 47935487 23969791 804214219210751 109 134217727 3141461868543 766958445 6135667565 4194303 7021 98171879423 201073188929535 7539508304749 14725602157 0