# Pastebin 3FRW8JEo my @pokemons = ; my %start = @pokemons.classify: *.substr: 0, 1; multi get-sequence(%s, Str:D $f) { return Empty without %s{$f}; do if %s{$f} -> @a { my @h = @a.grep: { %s{.substr: *-1, 1} }; return Empty unless @h; await do for @h -> $w { start { my %ns = %( |%s, |($f => @a.grep: * ne $w unless @a == 1) ); ($w, |samewith %ns, $w.substr: *-1, 1) } }.max: *.elems } } say await(%start.keys.map({ start get-sequence %start, $_ })).max: *.elems