# Pastebin k8vAJCp6 my @pokemons = ; my %start = @pokemons.classify: *.substr: 0, 1; multi get-sequence(%s, $f) { %s{$f}.?cache.map(-> $p { next unless $p; my $pokemons-on-f = (%s{$f} (-) $p).keys; my $last-letter = $p.substr: *-1, 1; start { ($p, |get-sequence %( |%s, $f => $pokemons-on-f ), $last-letter) } }).&await.max: *.elems } say await(%start.keys.map({ get-sequence %start, $_ })).max: *.elems