Just for the records, mine rearranged a bit more for 2 strokes less:

function a($b,$c)
    dim $,$d,$e
    $a=0
    for each $ in $b
            dim $f
            for each $d in $b
                dim $g
                for $e=2 to 0|$
                    if instr($d,right($,$e))=1
                        $g=$e
                    endif
                next
                if $g
                    if $d>$
                        $f=$f+$g+1
                        $=$+' '+$d
                    endif
                    $g=($|)-$f
                    if right($,1)=$c[1]&left($,1)=$c[0]&$g<$a|1>$a
                        $a=''+$g+' '+$
endfunction


Score:

Running Test 1...Done...Result: 11 about outside ideas
Running Test 2...Done...Result: 4 ones
Running Test 3...Done...Result: 0
Running Test 4...Done...Result: 7 aabbbb bbbbz
Running Test 5...Done...Result: 0
Running Test 6...Done...Result: 9 ayrton onset
Running Test 7...Done...Result: 6 kita tart
Running Test 8...Done...Result: 11 about outside ideas
Your solution passed all tests

Your solution passed all tests

KiXtart
KiXtart Version  = 4.53
KiXGolf Script   = kixgolf_A2Z.kix

Computer
OS               = Windows 2000 Professional
CPU              =               Intel(R) Pentium(R) 4 CPU 2.80GHz
Speed            = 2793 MHz
Memory           = 504 MB

KiXGolf Scoring Engine
Scoring Engine   = 3.3

KiXtart Golf Score
Tournament       = A-to-Z
Processing Start = 2007/09/13 13:52:30.734
Processing End   = 2007/09/13 13:52:30.765
Duration         = 0000/00/00 00:00:00.031
KiXGolf Score    = 231

Thank you for participating in KiXtart Golf!

_________________________